CommandPalette
The Cmd+K palette: filter grouped actions, arrow to move, Enter to run. Open state lives in a store.
or press ⌘ K
Last run: nothing yet
import { CommandPalette, useCommandPaletteStore, type CommandAction } from '@objectifthunes/whiteboard'
const actions: CommandAction[] = [
{ id: 'new-invoice', label: 'New invoice', group: 'Create',
keywords: ['bill', 'charge'], icon: <Plus size={13} />, onRun: createInvoice },
{ id: 'team', label: 'Go to team', group: 'Navigate',
keywords: ['members', 'seats'], onRun: () => router.push('/team') },
]
// once, near the root — binds Cmd+K itself
<CommandPalette actions={actions} />
// open it from anywhere
const setOpen = useCommandPaletteStore(s => s.setOpen)Actions are plain data, so the list can be assembled from wherever it lives: static app commands, the current page's row actions, recent search results from a fetch. Add keywordsfor the words people actually type — "bill" finding "New invoice" is the difference between a palette people use and one they forget.
Open state is a store, so a TopBar button, an empty-state link and another command can all drive it. Cmd+K and Ctrl+K are bound by the component; pass shortcut={false} to own the keybinding yourself.
Grouping is derived from consecutive group values, and the cursor walks the flat filtered list underneath. That means the highlighted row and the arrow keys can never disagree, which is the usual bug in grouped pickers.
Every open starts from an empty query. Resuming the last search sounds helpful and is almost never what the user wants.