Command Menu
ProNewA command palette with fuzzy search, highlighted matches, a gliding selection and a panel that resizes as you type.
Installation
pnpm dlx shadcn@latest add @viewport/command-menu
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| commands* | Command[] | — |
| open | booleanControlled open state. | — |
| onOpenChange | (open: boolean) => void | — |
| hotkey | string | falseLetter that toggles the menu with Cmd or Ctrl. Pass false to disable. | "k" |
| title | stringAccessible name for the dialog. | "Command menu" |
| placeholder | string | "Type a command or search…" |
| children | React.ReactNodeThe element that opens the menu, usually a button. | — |
Accessibility
- Radix Dialog with the combobox pattern: focus stays in the input.
- Arrow keys, Home and End move; Enter runs; Escape closes and restores focus.
- Cmd or Ctrl plus K toggles it; an empty result is announced.