Skip to main content

Overview

ESC
Navigation
Actions
↑↓ navigate↵ selectESC close
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)

Use Command directly (without CommandDialog) to embed the palette inline — useful for search inputs, comboboxes, and filter panels.
Search frameworks…

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

  • CommandDialog uses role="dialog" with aria-modal="true"
  • CommandInput is a search input with role="combobox" and aria-expanded
  • CommandList has role="listbox"; each CommandItem has role="option"
  • Keyboard: Arrow Up/Down navigates, Enter selects, Escape closes, typing filters
  • CommandEmpty is announced by screen readers when no results match

Do’s & Don’ts

Do

  • Register ⌘K / Ctrl+K globally to open the command palette
  • Group items with CommandGroup and clear heading labels
  • Show a visible keyboard shortcut hint in the UI (e.g. a button with ⌘K badge)
  • 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 Select or DropdownMenu
  • Don’t forget to close the dialog after an action is selected