# Command Menu

> A calm ⌘K command menu: fuzzy and server search, grouped results, nested pages, recents, hotkeys and full keyboard control, with optional filter pills.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Components › Overlays |
| Live preview | https://uibrik.com/components/command-menu |
| Writes | 1 file into `components/uibrik/command-menu/` |
| Packages | `@tabler/icons-react`, `motion` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 22, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/command-menu.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/command-menu`.

Can't run commands? https://uibrik.com/components/command-menu/prompt.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { CommandMenu } from "@/components/uibrik/command-menu/command-menu";

const items = [
  { id: "intro", type: "docs", label: "Introduction", keywords: ["overview", "about"] },
  { id: "install", type: "docs", label: "Installation", keywords: ["setup", "cli", "npm"] },
  // …11 more
];

const filters = [
  { id: "docs", label: "Get started" },
  { id: "components", label: "Components" },
  // …1 more
];

<CommandMenu
  placeholder="Search docs and components"
  shortcut="k"
  showFilters
  highlight
  footer
  blur
  width={580}
  hotkeys
  maxRecents={4}
  items={items}
  filters={filters}
  searchDelay={200}
  maxResults={100}
  defaultOpen={false}
  recentsKey="command-menu-recents"
  onSearch={(query, signal) => {}}
  onOpenChange={(open) => {}}
  onSelect={(item) => {}}
  // renderItem={(item, state) => {}}
  // labels={…}
  // open={false}
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/command-menu.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `placeholder` | `string` | `"Search docs and components"` | Text in the empty field and on the trigger. |
| `shortcut` | `string` | `"k"` | Key that toggles the menu with ⌘ / Ctrl. Empty turns the shortcut off. |
| `showFilters` | `boolean` | `true` | Show the filter pills. Tab cycles them from the keyboard. |
| `highlight` | `boolean` | `true` | Bold the letters of the label that matched the search. |
| `footer` | `boolean` | `true` | Keyboard hints and the result count under the list. |
| `blur` | `boolean` | `true` | Blur the page behind the menu. |
| `width` | `number` | `580` | Widest the menu gets. |
| `hotkeys` | `boolean` | `true` | Run an item's shortcut from anywhere on the page while the menu is closed. |
| `maxRecents` | `number` | `4` | Recently run commands listed first while the field is empty. 0 turns them off. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `items` | `CommandItem[]` | `SAMPLE_ITEMS` | What the menu can find or run: { id, label, type, icon?, description?, keywords?, shortcut?, disabled?, children?, onSelect? }. Give an item children to open a nested page. |
| `filters` | `CommandFilter[]` | `SAMPLE_FILTERS` | Filter pills and group headings, as { id, label }. An item's type picks its filter. |
| `onSearch` | `(query: string, signal: AbortSignal) => Promise<CommandItem[]>` |  | Fetches results from a server as the user types, shown beside the local ones. Called once typing pauses; abort the signal when a newer search starts. The demo searches a fake customer list this way. |
| `searchDelay` | `number` | `200` | Wait after the last keystroke before calling onSearch, in ms. |
| `maxResults` | `number` | `100` | Most rows shown at once. Longer lists are cut off; searching narrows them. |
| `renderItem` | `(item: CommandItem, state: { active: boolean; label: ReactNode }) => ReactNode` |  | Draws a row's contents yourself, e.g. a status badge or an amount. The row's highlight, height and click stay. |
| `labels` | `Partial<CommandLabels>` | `DEFAULT_LABELS` | Replaces any of the menu's text, for translation or your own wording. |
| `open` | `boolean` |  | Controlled open state. Leave out to let the menu keep its own. |
| `defaultOpen` | `boolean` | `false` | Whether it starts open. |
| `onOpenChange` | `(open: boolean) => void` |  | Called when the menu opens or closes. |
| `onSelect` | `(item: CommandItem) => void` |  | Called after a command runs, alongside its own onSelect. |
| `recentsKey` | `string` | `"command-menu-recents"` | localStorage key for recents. |
| `className` | `string` |  | Classes for the trigger button. |

## Where it fits

- **⌘K in SaaS apps**: Fuzzy and server search with grouped results lets users jump anywhere from the keyboard.
- **Docs site search**: Recents and nested pages help readers return to the page they had open yesterday. Pairs with [Search](https://uibrik.com/components/search.md) (Pro).
- **Power-user actions**: Hotkeys and filter pills turn the menu into a launcher for actions, not just pages.

## Same shelf: Overlays

- [Context Menu](https://uibrik.com/components/context-menu.md): A menu that opens where you right-click or long-press, with submenus, checkable items and full keyboard control.
- [Cookie Consent](https://uibrik.com/components/cookie-consent.md): A cookie consent banner that slides up after load, grows in place into per-category switches, remembers the visitor's choice in localStorage and reopens straight to their saved settings.
- [Dialog](https://uibrik.com/components/dialog.md): A modal that grows out of the button that opened it, holds focus, and eases back when another dialog opens on top.
- [Dropdown Menu](https://uibrik.com/components/dropdown-menu.md): A menu with icons, shortcuts, checkbox and radio items and submenus, a sliding highlight and full keyboard control.
- [Ferrofluid Menu](https://uibrik.com/components/ferrofluid-menu.md) (Pro): A glossy drop of ferrofluid that grows spikes toward the pointer, then pours out droplets that spread into a menu.
- [Gliding Tooltip](https://uibrik.com/components/gliding-tooltip.md): One tooltip shared by a row of icon buttons. It glides from button to button as the pointer moves, easing its width to each label, with a soft highlight gliding behind.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/command-menu/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
