Component
Command Menu
⌘K-style filterable, keyboard-navigable command palette.
Basic
Trigger with a shortcut hint
Kbd renders a single keyboard key/shortcut token - pair it with a visible trigger so the ⌘K chord is discoverable, not the only way in.
⌘K
- items also accept a shortcut string, rendered next to each command's label inside the palette
When to use
- App-wide quick navigation or actions triggered by a keyboard shortcut (⌘K) - jumping to pages, running commands, switching context.
- A searchable list long enough that scanning isn't practical - filtering narrows it as the user types.
When not to use
- A short, fixed action list tied to one trigger - a plain Dropdown Menu is lighter.
- Primary navigation that should always be visible - this is a supplementary, opt-in shortcut, not a nav replacement.
Keyboard
Mobile behavior
- Opens the same way as desktop (via the trigger button; the ⌘K shortcut itself is a desktop-keyboard convenience), and the on-screen keyboard opens immediately since the input is focused on open.
- The panel is width-clamped and vertically scrollable so a long, filtered result list doesn't overflow a short viewport.
Accessibility notes
- Composed from Dialog under the hood, so it inherits focus trap, Escape-to-close, and focus-return-to-trigger for free.
- Items are grouped visually by the group field; each group is exposed as its own labeled region for screen reader users.
Common mistakes
- Wiring the ⌘K shortcut listener but forgetting to also expose a visible trigger button - keyboard-shortcut-only entry points are undiscoverable and inaccessible to users who can't use that chord.
- Putting hundreds of items in one flat group - use group to organize a long list instead of one long unbroken scroll.
Known limitations
- No built-in async/remote data loading - items must already be in memory; filter debouncing for a remote source is left to the consumer.
Related components
CommandMenu props
open / onOpenChangeNone
boolean / (open: boolean) => voidControlled open state - CommandMenu has no uncontrolled mode.
itemsNone
{ id, label, group?, icon?, shortcut?, searchText?, onSelect }[]The full command list. Filtering, grouping, and highlighting are all handled internally.
placeholderNone
stringSearch input placeholder.
API reference
openNone
booleanControlled open state of the command dialog.
onOpenChangeNone
(open: boolean) => voidFires when the dialog opens or closes.
itemsNone
CommandMenuItem[]Commands with label, group, icon, shortcut, and onSelect.
placeholder"Type a command or search…"
stringSearch input placeholder.
classNameNone
stringAdditional classes applied to the component root.
