Command

Search and run commands from one list, inline on the page or as a ⌘K palette.

New document⌘N
Search files
Open recent
Notifications
Appearance
Toggle dark mode
Preferences⌘,
⌘J

Fig. 1 Type to filter the commands, then press Enter to run one.

When to use it

Use Command when there are many actions and people know them by name: switching projects, changing settings, running tools. Typing a few letters beats hunting through menus.

Open the palette from a visible button too, so people who don’t know the shortcut can still find it.

Dropdown menu

Actions from a button.

Choose an action to see its feedback.

Row actions and overflow menus.

CommandThis page

Search and run.

New document⌘N
Search files
Open recent
Notifications
Appearance
Toggle dark mode
Preferences⌘,
⌘J

Many actions people know by name.

Fig. 2 Two lists of actions. One opens from a button; the other is searched by name.

How it behaves

Pass items to Command, flat or grouped as { value, items }, and render them with CommandList, CommandGroup, and CommandCollection. Base UI filters the items as the query changes; item objects shaped { value, label } filter by label.

The first match stays highlighted, so Enter runs it; arrow keys move the highlight. Handle each command with onClick on CommandItem. This differs from shadcn's cmdk-based Command, which filters its children directly.

CommandDialog places the palette in a modal with an accessible title and description. It opens and closes without animation because a palette is used many times a day; open it from a shortcut such as ⌘K with your own key handler.

CommandShortcut shows a plain Kbd at the end of an item. Give CommandInput a placeholder; it is labeled Search by default.

Build it

Add it with the shadcn CLI:

Terminal

A complete example. Change the values to fit your product:

command-example.tsx

The full source is yours to edit once installed:

command.tsx