Command
The ⌘K palette — one overlay that searches everything, with a global shortcut it binds itself.
Loading documentation…
The command palette: the overlay that lands near the top of the screen and searches everything at once.
It is deliberately not a dialog you happen to put an input in. It sits high rather than centred, so results grow downward into space you were already looking at; it opens on a global shortcut; and Escape is the only button it needs.
Mount it once near the root. It binds ⌘K / Ctrl K
itself — there is no provider, and no key handler for you to write.
Every row is data. label and description are both matched against the
query, keywords adds terms that match without being shown, and group sorts
rows under a heading in first-seen order.
An item's own onSelect runs first, then the palette's onSelect — one for
the row, one for the "whatever was chosen" path.
Pass onQueryChange and the palette stops filtering: items is rendered
exactly as given, so you can debounce, hit an API, and rank the results
yourself. loading swaps the leading icon for a spinner while they are in
flight.
trigger renders anything that opens the palette — usually a button in the
header. Command.Shortcut spells a shortcut for the current platform, so the
same markup shows ⌘K on macOS and Ctrl K everywhere
else.
Command is a global overlay. For a field with a dropdown of matches inside a
form, reach for Combobox.
Everything the palette can find.
The global shortcut that opens it. "mod+k" is ⌘K on macOS and Ctrl K
elsewhere. It defaults to "mod+k"; pass false to bind it yourself.
Anything that opens the palette — a header button, a menu row.
Controlled and uncontrolled open state.
Fires for every chosen row, after the item's own onSelect.
Takes over filtering. When set, items is rendered exactly as given.
The controlled query. Only needed alongside onQueryChange.
Swaps the leading icon for a spinner while results are in flight.
Placeholder for the search field.
Shown when nothing matches.
Replaces the default ↑↓ / ↵ / esc legend. Pass false to drop the bar.
A stable id, handed back to onSelect.
The row's headline. Matched against the query.
A second line — a path, an id, what the action does. Also matched.
The leading glyph.
A right-aligned hint, usually a Kbd.Group.
The section heading this row lives under.
Extra terms to match on without showing them.
Dims the row and ignores interaction.
Runs when the row is chosen, before the palette closes.
A shortcut such as "mod+k", rendered as Kbd keys for this platform.