Skip to content

Command palette

In review
Live · web

Press ⌘K (or Ctrl-K) inside the stage: type, ↑↓, Enter, Esc

Press K or the button above to launch

No command run yet. Launch the palette and press Enter on a row.

// Web: React, consuming @dizyx/nockerl-tokens. (Web is the laggard platform. Spec + live demo,
// not yet exported from @dizyx/nockerl-react; promotion is tracked.)
const commands = [
{ id: 'new-session', label: 'New session', hint: 'Start a fresh session',
group: 'Actions', icon: 'plus', shortcut: ['', 'N'], run: createSession },
{ id: 'go-inbox', label: 'Go to Inbox', hint: '3 unread', group: 'Navigation',
icon: 'inbox', shortcut: ['G', 'I'], run: => navigate('/inbox') },
{ id: 'recent-design', label: 'nockerl-design · docs', group: 'Recent',
icon: 'doc', run: => openSession('design') },
];
export function App() {
const [open, setOpen] = useState(false);
// ⌘K / Ctrl-K toggles the palette from anywhere.
useHotkey('mod+k', => setOpen((v) => !v));
return (
<CommandPalette
open={open}
onOpenChange={setOpen}
commands={commands}
groupOrder={['Actions', 'Navigation', 'Recent']}
placeholder="Type a command or search…"
/>
);
}
PropTypeDefaultDescription
open *booleanWhether the palette is shown. Drops a scrim and floats the panel near top-center.
onOpenChange *(open: boolean) => voidFired on Esc, scrim click, or after a command runs. Focus is restored to the trigger on close.
commands *Command[]The full set. Each: { id, label, hint?, group, icon, shortcut?, run, disabled? }. Filtered live by what is typed (label + hint substring).
groupOrderstring[]['Actions','Navigation','Recent']Section order. Headers render above each non-empty bucket; ↑↓ flow across groups in this order.
placeholderstring'Search…'Search-field placeholder. The field is a persistent input, never a label.
emptyLabelstring'No results'Shown with the query when nothing matches, above a quiet “Try a different search.”