Navigation
The Cmd+K overlay: a search box over a fuzzy-filtered, grouped list of actions and destinations, with full keyboard navigation and a useCommandPalette hotkey hook.
or press ⌘K / Ctrl+K
| Prop | Type | Default | Description |
|---|---|---|---|
isOpen | boolean | — | Whether the palette is shown. |
onClose | () => void | — | Fired on Escape, outside click, and after a selection. |
onSelect | (item) => void | — | Fired on activation, after the item's own onSelect. |
filter | (items, query) => items | built-in fuzzy | Replace the matcher; return the items to show, already ordered. |
isLoading | boolean | false | Spinner in the input; suppresses the empty message. |
onQueryChange | (query) => void | — | Fired as the query changes. |
closeOnEscape / closeOnOutsideClick / portal / container / zIndex / blur | — | — | Passed through to Backdrop. |
hotkey | "mod+k" | string | false | "mod+k" | Global open/toggle shortcut. mod = ⌘ on Apple platforms, Ctrl elsewhere. false binds nothing. |
defaultOpen | boolean | false | Initial open state. |
onOpenChange | (open) => void | — | Fired when the open state changes. |
isOpen
boolean
Default: —
Whether the palette is shown.
onClose
() => void
Default: —
Fired on Escape, outside click, and after a selection.
onSelect
(item) => void
Default: —
Fired on activation, after the item's own onSelect.
filter
(items, query) => items
Default: built-in fuzzy
Replace the matcher; return the items to show, already ordered.
isLoading
boolean
Default: false
Spinner in the input; suppresses the empty message.
onQueryChange
(query) => void
Default: —
Fired as the query changes.
closeOnEscape / closeOnOutsideClick / portal / container / zIndex / blur
—
Default: —
Passed through to Backdrop.
hotkey
"mod+k" | string | false
Default: "mod+k"
Global open/toggle shortcut. mod = ⌘ on Apple platforms, Ctrl elsewhere. false binds nothing.
defaultOpen
boolean
Default: false
Initial open state.
onOpenChange
(open) => void
Default: —
Fired when the open state changes.
| Prop | Type | Default | Description |
|---|---|---|---|
items | CommandPaletteItem[] | — | The commands and destinations. |
query / defaultQuery | string | "" | Controlled / initial query. |
emptyQueryItems | CommandPaletteItem[] | all items | List shown while the query is empty (recent / suggested). |
items
CommandPaletteItem[]
Default: —
The commands and destinations.
query / defaultQuery
string
Default: ""
Controlled / initial query.
emptyQueryItems
CommandPaletteItem[]
Default: all items
List shown while the query is empty (recent / suggested).
| Prop | Type | Default | Description |
|---|---|---|---|
placeholder | string | "Type a command or search…" | Input placeholder. |
emptyMessage | ReactNode | "No results" | Shown when nothing matches. |
footer | ReactNode | — | Content below the list. |
placeholder
string
Default: "Type a command or search…"
Input placeholder.
emptyMessage
ReactNode
Default: "No results"
Shown when nothing matches.
footer
ReactNode
Default: —
Content below the list.
| Prop | Type | Default | Description |
|---|---|---|---|
size | "sm" | "md" | "lg" | md | Palette width (480 / 600 / 720). |
size
"sm" | "md" | "lg"
Default: md
Palette width (480 / 600 / 720).
| Prop | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | "Command palette" | Accessible name for the dialog and listbox. |
ariaLabel
string
Default: "Command palette"
Accessible name for the dialog and listbox.
| Prop | Type | Default | Description |
|---|---|---|---|
classNames | { base?, header?, input?, list?, group?, item?, … } | — | Slot classes. |
classNames
{ base?, header?, input?, list?, group?, item?, … }
Default: —
Slot classes.