Skip to content

CommandPalette

const CommandPalette: React.FC<CommandPaletteProps>

Defined in: src/components/feedback/CommandPalette/CommandPalette.tsx:81

Search-driven command list shown as a centred floating dialog. Type to fuzzy-filter, ArrowUp/ArrowDown to navigate, Enter to select, Escape to close. Recent selections are tracked in localStorage when recentKey is set. The component does not bind a global hotkey — wire useHotkey in the consumer.

Example

useHotkey('Mod+K', () => { setOpen(true); });
<CommandPalette
open={open}
onClose={() => setOpen(false)}
items={[
{ id: 'open', label: 'Open File', shortcut: 'Cmd+O', group: 'File' },
{ id: 'save', label: 'Save', shortcut: 'Cmd+S', group: 'File' },
]}
onSelect={(item) => runCommand(item.id)}
recentKey="myapp:command-palette"
/>