Command Palette
A modal launcher with fuzzy search across registered commands, opened via a global hotkey.
Basic Usage
Default Command Palette
Open with ⌘K (or Ctrl+K) or click the button. Type to filter, arrow keys to navigate, Enter to run, Esc to close.
import { CommandPalette } from 'fluxo-ui';
const [open, setOpen] = useState(false);
const [last, setLast] = useState('');
const commands = [
{ id: 'new', title: 'New file', group: 'File', shortcut: '⌘N', icon: EditIcon, onSelect: () => setLast('new') },
{ id: 'open', title: 'Open file', group: 'File', shortcut: '⌘O', icon: CopyIcon, onSelect: () => setLast('open') },
{ id: 'settings', title: 'Open settings', group: 'App', shortcut: '⌘,', icon: SettingsIcon, onSelect: () => setLast('settings') },
];
<CommandPalette open={open} onOpenChange={setOpen} commands={commands} />Customization
Custom hotkey, group order, placeholder, empty message
Open with mod+/. Hidden command items (disabled) are visually dimmed and not selectable.
<CommandPalette
open={open}
onOpenChange={setOpen}
commands={commands}
hotkey="mod+/"
placeholder="Type to search..."
emptyMessage={<span>Nothing matches "{query}"</span>}
groupOrder={['Navigation', 'Actions']}
maxResults={20}
/>Import
import { CommandPalette } from 'fluxo-ui';
import type { CommandPaletteProps, CommandPaletteCommand } from 'fluxo-ui';Props
commandsreqArray<CommandPaletteCommand>Registered commands: { id, title, subtitle?, group?, keywords?, icon?, shortcut?, onSelect, disabled?, danger? }
commandsreqArray<CommandPaletteCommand>Registered commands: { id, title, subtitle?, group?, keywords?, icon?, shortcut?, onSelect, disabled?, danger? }
openbooleanControlled open state
openbooleanControlled open state
onOpenChange(open: boolean) => voidCalled when the palette opens or closes
onOpenChange(open: boolean) => voidCalled when the palette opens or closes
hotkeystring"'mod+k'"Global hotkey to toggle the palette ('mod' = Cmd on Mac, Ctrl elsewhere)
hotkeystring"'mod+k'"Global hotkey to toggle the palette ('mod' = Cmd on Mac, Ctrl elsewhere)
placeholderstring"'Type a command or search...'"Search input placeholder
placeholderstring"'Type a command or search...'"Search input placeholder
emptyMessagestring | ReactNode"'No commands found'"Shown when no commands match the query
emptyMessagestring | ReactNode"'No commands found'"Shown when no commands match the query
recents{ storageKey?: string; limit?: number }When provided, persists recently selected ids to localStorage
recents{ storageKey?: string; limit?: number }When provided, persists recently selected ids to localStorage
groupOrderstring[]Explicit ordering of group headings
groupOrderstring[]Explicit ordering of group headings
maxResultsnumber"50"Maximum number of items to show
maxResultsnumber"50"Maximum number of items to show
filterFn(command, query: string) => numberCustom scorer; return 0 to hide. Default: subsequence match on title/keywords/group
filterFn(command, query: string) => numberCustom scorer; return 0 to hide. Default: subsequence match on title/keywords/group
idstringHTML id attribute
idstringHTML id attribute
classNamestringAdditional CSS classes
classNamestringAdditional CSS classes
ariaLabelstring"'Command palette'"Accessible label for the dialog
ariaLabelstring"'Command palette'"Accessible label for the dialog
Features
Global Hotkey
⌘K / Ctrl+K out of the box — fully configurable with the hotkey prop.
Fuzzy Search
Sub-sequence matching with score-based ranking; supply a custom filterFn for full control.
Recents
Optional localStorage-backed recents bubble up under no-query state.
Full Keyboard
Arrow / Home / End to navigate, Enter to run, Esc to close, Tab cycles input/list.