Skip to content
Zuno UI
Explore components
EXPLORE
Actions
Forms
Layout
Navigation
Data display
Feedback
Overlays
RESOURCES
Components/Command

Command

A searchable list of actions with groups, shortcuts and a clear empty state.

Base UI reference ↗
Calendar
Search emoji
Calculator
Profile
Billing
Settings

Installation

Run it from the root of a project already set up with zunoui init.

npx zunoui@latest add command

Dependencies

What add command installs alongside the component. The CLI skips any you already have in a compatible version.

ZUNO registry

  • @zuno/utils

npm

Examples

2 examples · 1 component
command
Calendar
Search emoji
Calculator
Profile
Billing
Settings

Groups and shortcuts

Inline palette with two groups, key hints and an empty state.

command

Palette in a dialog

A button and ⌘K / Ctrl K open it; choosing an action closes it.

API reference

Keeps the props, events and refs of the matching Base UI primitive, plus ZUNO's styles.

PropTypeDefault
Command

Base UI Autocomplete rendered inline and always open, with the first match highlighted. items (strings, { value, label } objects or groups) is required for filtering; also filter, limit and onValueChange.

——
CommandInput

Search field with a leading icon. Name it with aria-label or a Label.

input—
CommandList

Scrollable list; its child is a function that renders each item or group.

div—
CommandItem

An action. onClick runs on click and on Enter; value is the item from items.

div—
CommandGroup / CommandGroupLabel / CommandCollection

Groups: pass the group's items to CommandGroup and render them with CommandCollection. The label must sit inside the group.

div—
CommandEmpty

Shown only when nothing matches.

div—
CommandSeparator

Divider between groups.

div—
CommandShortcut

Key hint at the end of an item; hidden from assistive tech.

span—
CommandDialog

Modal near the top of the screen with an sr-only title and close button; open/onOpenChange like Dialog.

Dialogtitle = "Command palette"

States

The states that apply to this component and their visual treatment.

StateTreatment
RestEvery item listed; the first one highlighted.
FilteredOnly matching items remain, grouped as before.
HighlightedAccent surface on the active item, by keyboard or pointer.
EmptyCommandEmpty replaces the list.
DisabledDimmed and announced as unavailable; arrow keys still reach it, but Enter and clicks do nothing.

Accessibility

The input is a combobox that owns the list: arrow keys move through items while focus stays in the input, and Enter runs the highlighted one.

The first match stays highlighted as you type, so Enter always has a target; CommandEmpty explains when there is none instead of an empty box.

In CommandDialog the input takes focus on open, the dialog is named by its hidden title, and Escape closes it and returns focus to the trigger.

A keyboard shortcut (⌘K / Ctrl K) must never be the only way in: keep a visible button that opens the palette.

Shortcut hints are hidden from screen readers; the item's own text is its name.