Overlays
Command palette
Search and run anything with ⌘K.
Usage
A searchable list of pages and actions. CommandDialog puts the palette in a modal at the top of the screen; with hotkey it toggles on ⌘K / Ctrl + K from anywhere on the page.
Nothing run yet
Inline
Command on its own is the same palette in the page flow, for a search page or a settings finder. Type to filter: results are ranked by prefix, then word start, then substring, and keywords find an item by other names (try "dark mode").
Nothing run yet
When to use
- Apps with many destinations and actions, where power users want to jump by typing.
- As an addition to navigation, never the only way to reach something.
Not for: a short choice from a fixed list (use a select), or free-text search results with their own page.
API
Command
| Prop | Type | Default | Description |
|---|---|---|---|
| search | string | — | Controlled search text; also defaultSearch and onSearchChange. |
| shouldFilter | boolean | true | Filter and rank items. Set false to filter yourself, e.g. async results. |
| filter | (value, search, keywords) => number | — | Custom scorer: 0 hides an item, higher ranks it first. |
| label | string | — | Accessible name of the palette. |
| onItemSelect | (value: string) => void | — | Called after any item runs. |
CommandItem
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | What the search matches. Defaults to the item text. |
| keywords | string[] | — | Extra words that find the item. |
| icon | ReactNode | — | Leading 16px icon. |
| shortcut | ReactNode | — | A string such as "⌘N" becomes key caps; or pass your own node. |
| disabled | boolean | — | Skipped by the arrows, cannot run. |
| onSelect | (value: string) => void | — | Runs on click or Enter. |
CommandDialog
| Prop | Type | Default | Description |
|---|---|---|---|
| open / defaultOpen / onOpenChange | boolean | — | Controlled or uncontrolled open state. |
| hotkey | boolean | false | Toggle with ⌘K / Ctrl + K. |
| closeOnSelect | boolean | true | Close after an item runs. |
| title | string | 'Command palette' | Visually hidden dialog title. |
Also: CommandInput, CommandList, CommandGroup (heading), CommandEmpty, CommandSeparator and CommandFooter. Groups hide when a search leaves them empty; separators hide while searching. Better matches float to the top of their group.
Keyboard
| Key | Action |
|---|---|
| ⌘K / Ctrl + K | Opens or closes the dialog (when hotkey is on). |
| ↓ / ↑ | Next / previous item (wraps around). Focus stays in the search field. |
| Home / End | First / last item. |
| Enter | Runs the highlighted item. |
| Esc | Closes the dialog. |
Accessibility
- The search field is a combobox with aria-controls on the listbox and aria-activedescendant on the highlighted option, so focus never leaves the field.
- Items are role="option" with aria-selected; groups are labelled by their heading.
- The dialog is a modal with a hidden title; the field is focused on open and the search resets on close.
- Pointer hover moves the highlight; touch taps run the item.
Motion
- The dialog uses the standard soft rise: overlay fade, panel rise 8px with scale .96 and un-blur.
- The highlight changes instantly (100ms tint) so fast typing never feels laggy.
- Reduced motion: it appears and disappears without movement.