Skip to content
HyperDesign System

Command

A searchable list of actions: type to filter, arrows to move, Enter to run. Inline or as a ⌘K palette in the dialog shell. Built on cmdk. Source: src/components/ui/command.tsx.

Groups and shortcuts

Grouped items with icons and Kbd shortcuts, a disabled row, and an empty state. Try “team”: keywords match rows whose text doesn't contain the word.

ran: nothing yet

Palette

CommandDialog wraps the same parts in Dialog: focus trap, scrim, Esc. Two things are yours to add: the ⌘K binding (this page binds ⌘K / Ctrl+K to the demo), and focus return, because there is no DialogTrigger for Radix to send focus back to.

ran: nothing yet

Empty state

CommandEmpty renders only when nothing matches. Say what was searched and how to get back. Clear the field to see the list.

Keyboard

Command keyboard map
KeyWhereDoes
typeFilters and ranks items by fuzzy match on their text and keywords. Groups with no matches hide.
↑ ↓Move the selection. Focus stays in the input; the selected row gets data-selected and a tint fill.
EnterRun the selected item's onSelect.
EscClose. Focus lands on <body> unless you restore it (see Palette).
⌘KNot built in. Bind it yourself, as the demo does.

Layout and motion

The list itself does not animate: rows appear and disappear as you type, which is right for something used dozens of times a day. Only the dialog shell moves.

Command layout and motion
ValueTokenUsage
25%Set by CommandDialog, but the dialog shell centres the panel (m-auto), so in practice it sits mid-screen and the input moves as results shrink.
300pxCommandList's cap; longer lists scroll.
48pxInput row height, and item rows in CommandDialog (py-3).
200msDialog enter (fade + scale from 95%); exit on --duration-exit.
50Inherited from Dialog. The brand ladder (--z-modal 200) is defined but not wired in yet.

Props

Command parts and props
Part / propTypeDefaultDescription
Commandcmdk Command—Root. label, value / onValueChange (selected item), shouldFilter, filter, loop.
CommandDialogDialog.Root + Command—Command inside the Dialog shell. Takes Dialog's open, onOpenChange.
titlestring"Command Palette"sr-only DialogTitle.
descriptionstring"Search for a command to run..."sr-only DialogDescription.
showCloseButtonbooleanfalseDialog's corner X.
classNamestring—Merged onto the DialogContent.
CommandInputcmdk Input—value, onValueChange (the search), placeholder. Search icon built in.
CommandListcmdk List—The scrolling list, capped at 300px.
CommandEmptycmdk Empty—Shown only when no item matches.
CommandGroupcmdk Group—heading (caps label), forceMount.
CommandItemcmdk Item—onSelect, value, keywords, disabled, forceMount.
CommandSeparatorcmdk Separator—Hairline; hidden while a search is active unless alwaysRender.
CommandShortcutComponentProps<"span">—Right-aligned slot for Kbd. Display only.

Best practices

When to use

  • A global palette for jumping and running actions, or a searchable list inside a panel.
  • A short fixed list is a DropdownMenu. A searchable form value (combobox) is not built yet; Command inside a Popover is the intended route.

Behavior

  • Close the palette after a run; keep it open only for toggles.
  • Add keywords for synonyms rather than renaming items.
  • Long async results: set shouldFilter={false} and filter on the server.

Accessibility

  • Give an inline Command a label; CommandDialog takes title and description (rendered sr-only).
  • Focus stays in the input; cmdk exposes the selection with aria-activedescendant.
  • Shortcuts shown in CommandShortcut must actually be bound somewhere.

Content

  • Start items with a verb for actions (New thread) and a name for places (Settings).
  • Group headings are short nouns: Create, Go to, Theme.