Skip to main content

Module command

Module command 

Source
Expand description

Command palette molecule component

A command palette/search component with keyboard navigation. Similar to VS Code’s cmd+palette or shadcn’s Command component.

§Example

use dioxus_ui_system::molecules::command::*;

fn MyCommand() -> Element {
    let mut value = use_signal(|| "".to_string());
     
    rsx! {
        Command {
            CommandInput {
                placeholder: "Search commands...",
                value: value(),
                on_value_change: move |v| value.set(v),
            }
            CommandList {
                CommandEmpty { "No results found." }
                CommandGroup {
                    heading: "Suggestions",
                    CommandItem {
                        value: "calendar",
                        on_select: move |_| println!("Calendar selected"),
                        "Calendar"
                    }
                    CommandItem {
                        value: "search",
                        on_select: move |_| println!("Search selected"),
                        "Search"
                    }
                }
                CommandSeparator {}
                CommandGroup {
                    heading: "Settings",
                    CommandItem {
                        value: "profile",
                        on_select: move |_| println!("Profile selected"),
                        "Profile"
                    }
                }
            }
        }
    }
}

Re-exports§

pub use CommandSeparator_completions::Component::CommandSeparator;
pub use CommandLoading_completions::Component::CommandLoading;

Structs§

CommandEmptyProps
Command empty properties
CommandGroupProps
Command group properties
CommandInputProps
Command input properties
CommandItemProps
Command item properties
CommandListProps
Command list properties
CommandProps
Command container properties
CommandShortcutProps
Command shortcut properties

Functions§

Command
Command container component
CommandEmpty
Command empty component
CommandGroup
Command group component
CommandInput
Command input component
CommandItem
Command item component
CommandList
Command list component
CommandLoading
Command loading component
CommandSeparator
Command separator component
CommandShortcut
Command shortcut component