Overview
Command is a keyboard-first command palette — typically opened with
⌘K — that allows users to search, navigate, and trigger actions without leaving the keyboard. It supports grouped results, icons, and keyboard shortcuts.
Installation
Usage
Variants
Inline (Embedded in Page)
UseCommand directly (without CommandDialog) to embed the palette inline — useful for search inputs, comboboxes, and filter panels.
Dialog (Global ⌘K Palette)
The most common pattern — full-screen overlay opened with a keyboard shortcut.API Reference
Command
string
Controlled selected item value.
(value: string) => void
Callback fired when the selected item changes.
(value: string, search: string) => number
Custom filter function. Return
1 to show, 0 to hide. Default: fuzzy search.boolean
default:"true"
Set to
false to disable built-in filtering (handle externally with async search).CommandDialog
boolean
Controlled open state.
(open: boolean) => void
Callback fired when open state changes.
CommandInput
string
Placeholder text shown when empty.
string
Controlled input value.
CommandItem
string
The value used for filtering and selection.
(value: string) => void
Callback fired when the item is selected (Enter or click).
boolean
default:"false"
Disables the item.
CommandGroup
string
Group label shown above the items.
Accessibility
CommandDialogusesrole="dialog"witharia-modal="true"CommandInputis a search input withrole="combobox"andaria-expandedCommandListhasrole="listbox"; eachCommandItemhasrole="option"- Keyboard: Arrow Up/Down navigates, Enter selects, Escape closes, typing filters
CommandEmptyis announced by screen readers when no results match
Do’s & Don’ts
Do
- Register
⌘K/Ctrl+Kglobally to open the command palette - Group items with
CommandGroupand clearheadinglabels - Show a visible keyboard shortcut hint in the UI (e.g. a button with
⌘Kbadge) - Use
shouldFilter={false}for server-side or async search
Don't
- Don’t put destructive actions in the command palette without confirmation
- Don’t list more than 20–30 items without grouping or filtering
- Don’t use Command as a regular dropdown — use
SelectorDropdownMenu - Don’t forget to close the dialog after an action is selected