Command palette
⌘K opens it. Fuzzy search lights the letters you matched, Enter on an item with a page slides in the next step, and the panel's height follows what is left. Drag a step to the right to go back.
npx shadcn@latest add @uimaxxer/command-palettePasskeysFix the duplicate Stripe charge
Nothing run yet
Command palette is a Pro component
The demo and the docs are free. The source comes with Pro, through this page, the shadcn CLI and the MCP.
Usage
import { CommandPalette } from "@/components/ui/command-palette"
<CommandPalette
groups={[{ heading: "Runs", items: [
{ id: "start", label: "Start a new run", icon: "play", shortcut: ["⌘", "N"], onSelect: start },
{ id: "assign", label: "Assign to agent…", page: { title: "Assign", groups: agents } },
] }]}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| groups | CommandGroup[] | { heading, items }. Items: id, label, icon or mark, hint, shortcut, keywords, onSelect, page. | |
| item.page | CommandPage | { title, placeholder, groups }. Enter opens it; Backspace on an empty field goes back. | |
| open | boolean | Controlled open state. Pair with onOpenChange. | |
| hotkey | boolean | true | Toggle on ⌘K or Ctrl+K. |
| placeholder | string | "Search or run a command" | Field placeholder on the first page. |
| closeOnSelect | boolean | true | Close after an item runs. |
| fuzzy(query, text) | function | The matcher, exported: returns { score, hits } or null. |
Keyboard
- ⌘K
- Open or close
- ↑ ↓
- Move
- Enter
- Run, or open the item's page
- Backspace
- Back a page when the field is empty
- Esc
- Back a page, then close
Accessibility
- A modal dialog with a combobox and listbox; the active row is aria-activedescendant, so focus never leaves the field.
- Focus returns to whatever was focused before it opened.
- Rows are options with aria-selected; group headings are presentational.