Skip to main content

Module command_palette

Module command_palette 

Source
Expand description

Command Palette Component

A searchable command palette (Ctrl+K / Cmd+K style) for quick command access.

§Usage

use egui::{Key, KeyboardShortcut, Modifiers};
use egui_charts::ui_kit::command_palette::{Command, CommandPaletteHandler};

// Create a handler with commands
let mut handler = CommandPaletteHandler::new(vec![
    Command::new("new_chart", "New Chart")
        .shortcut(KeyboardShortcut::new(Modifiers::COMMAND, Key::N))
        .category("File"),
    Command::new("settings", "Open Settings")
        .category("Preferences"),
    Command::new("add_indicator", "Add Indicator")
        .category("Trading"),
]);

// In your update loop
if let Some(command_id) = handler.update(ctx) {
    match command_id.as_str() {
        "new_chart" => { /* create a new chart */ }
        "settings" => { /* open settings */ }
        "add_indicator" => { /* show the indicator dialog */ }
        _ => {}
    }
}

Structs§

Command
A command that can be executed from the command palette
CommandPalette
Command palette widget for quick command access
CommandPaletteHandler
Handler for managing command palette state
FuzzyMatch
Result of a fuzzy match

Functions§

fuzzy_match
Perform fuzzy matching of a query against a target string
fuzzy_search
Search through a list of items and return matches sorted by score