CommandMenu

1 field over every action. Type, arrow, Enter.

Installation

Installs the Base UI flavor. Switch in the right panel.

Playground

Inspect
CalendarToday
New fileBlank documentN
SettingsAccount and workspace,
Search everywhereFiles, people, messagesF
Toggle dark modeSystem, light, or darkL
Copy linkTo this pageC
Invite peopleSend an email invite
Export as PDFPro plan
Home
Inbox3 unread
Starred
RecentLast 7 days
Documentation
What's newRelease notes
Contact supportReply within a day
SelectRun

Basic

Type to filter, press ↓ ↑ to move, Enter to run. Rows come from items, grouped by group.

Inspect
New file
Search everywhere
Toggle dark mode
Copy link
Invite people
Export as PDF
Home
Inbox
Calendar
Starred
Recent
Settings
Documentation
What's new
Contact support

Descriptions, shortcuts, disabled rows

3 more fields per row: description, shortcut caps, and disabled, which the arrows skip. Type clipboard: keywords match too.

Inspect
New fileBlank documentN
Search everywhereFiles, people, messagesF
Toggle dark modeSystem, light, or darkL
Copy linkTo this pageC
Invite peopleSend an email invite
Export as PDFPro plan
Home
Inbox3 unread
CalendarToday
Starred
RecentLast 7 days
SettingsAccount and workspace,
Documentation
What's newRelease notes
Contact supportReply within a day

Suggestions

3 suggested rows lead until you type 1 letter, then the groups take over.

Inspect
CalendarToday
New fileBlank documentN
SettingsAccount and workspace,
Search everywhereFiles, people, messagesF
Toggle dark modeSystem, light, or darkL
Copy linkTo this pageC
Invite peopleSend an email invite
Export as PDFPro plan
Home
Inbox3 unread
Starred
RecentLast 7 days
Documentation
What's newRelease notes
Contact supportReply within a day

Tabs

Click a tab or press ← →, then derive items from the value. Children hug the row's end: put CommandMenuFilters there to share the line.

Inspect
New fileBlank documentN
Search everywhereFiles, people, messagesF
Toggle dark modeSystem, light, or darkL
Copy linkTo this pageC
Invite peopleSend an email invite
Export as PDFPro plan
Home
Inbox3 unread
CalendarToday
Starred
RecentLast 7 days
SettingsAccount and workspace,
Documentation
What's newRelease notes
Contact supportReply within a day

Filters

A frameless compact row under the field: drop borderless Selects or ghost Buttons in.

Inspect
New fileBlank documentN
Search everywhereFiles, people, messagesF
Toggle dark modeSystem, light, or darkL
Copy linkTo this pageC
Invite peopleSend an email invite
Export as PDFPro plan
Home
Inbox3 unread
CalendarToday
Starred
RecentLast 7 days
SettingsAccount and workspace,
Documentation
What's newRelease notes
Contact supportReply within a day

Dialog and trigger shortcut

Press ⌘P anywhere on this page: this demo binds its own combo, and the default ⌘K opens the playground above. A pick or Escape closes it.

Inspect

Footer hints

4 hints at most, following the menu: ← → with tabs, Esc in a dialog. Pass hints for your own.

Inspect
CalendarToday
New fileBlank documentN
SettingsAccount and workspace,
Search everywhereFiles, people, messagesF
Toggle dark modeSystem, light, or darkL
Copy linkTo this pageC
Invite peopleSend an email invite
Export as PDFPro plan
Home
Inbox3 unread
Starred
RecentLast 7 days
Documentation
What's newRelease notes
Contact supportReply within a day
SelectRun

Custom rows

1 CommandMenuItem per row from renderItem: children replace the label, the icon and caps stay.

Inspect
New fileActionsN
Search everywhereActionsF
Toggle dark modeActionsL
Copy linkActionsC
Invite peopleActions
Export as PDFActions
HomeGo to
InboxGo to
CalendarGo to
StarredGo to
RecentGo to
SettingsGo to,
DocumentationHelp
What's newHelp
Contact supportHelp

API Reference: Item data

PropTypeDefaultDescription
valuestringUnique id. The row's key and what aria-activedescendant points at.
labelstringThe row's text.
descriptionstringText after the label, at its size, 1 contrast step lower.
iconIconComponentLeading icon.
shortcutstringCaps at the trailing edge, e.g. "mod+p" or "⌘P". Display only.
keywordsstring[]Extra terms the filter matches besides label and description.
groupstringHeading the row lists under. Groups keep first-appearance order; ungrouped rows form an unlabelled section.
disabledbooleanfalseListed and greyed; the arrows and the pointer skip it.
onSelect() => voidRuns when the row is picked, before the root's onSelect.

API Reference: CommandMenu

PropTypeDefaultDescription
itemsCommandMenuItemData[]The actions. Keep the array stable: the highlight resets to the first row when the rows change.
onSelect(item) => voidRuns when a row is picked, after the item's own onSelect.
filter(item, query: string) => booleanMatch an item against the query. Default: every word of the query appears in label, description, or keywords.
querystringControlled query.
defaultQuerystring""Initial query.
onQueryChange(query: string) => voidCalled on every keystroke.
suggestionsstring[]Values listed first, under suggestionsLabel, while nothing is typed. A suggested row leaves its own group.
suggestionsLabelstring"Suggestions"Heading of the suggestions section.
closeOnSelectbooleantrueInside CommandMenuDialog, a pick closes the dialog.
size"default" | "compact"Pins field and rows to one size step. Omitted, both follow the SizeProvider.

API Reference: CommandMenuDialog

PropTypeDefaultDescription
openbooleanControlled open state.
defaultOpenbooleanfalseInitial open state.
onOpenChange(open: boolean) => voidCalled when the dialog opens or closes, including from the shortcut.
shortcutstring | null"mod+k"The combo that toggles the dialog from anywhere: "mod" is ⌘ on a Mac and Ctrl elsewhere, joined with "+" to alt, shift, and one key. null binds nothing.
titlestring"Command menu"The dialog's name for screen readers.
descriptionstring"Search for a command to run."Read after the title.
modalbooleantrueTraps focus and locks page scroll while open.
containerHTMLElement | nullPortal target, to scope the dialog to a region.
classNamestringMerged onto the panel. Anchored 12dvh from the top, sized by its rows up to min(440px, 76dvh).

API Reference: CommandMenuInput

PropTypeDefaultDescription
placeholderstring"Type a command or search…"Shown while nothing is typed.
iconIconComponent | nullsearchLeading icon. null drops it.

API Reference: CommandMenuTabs

PropTypeDefaultDescription
tabs{ value: string; label: string; icon?: IconComponent }[]1 subtle tab each.
valuestringThe selected tab's value.
onValueChange(value: string) => voidCalled on a pick. Derive items from the value.

API Reference: CommandMenuList

PropTypeDefaultDescription
renderItem(item, index: number) => ReactNodeCustom rows: return a CommandMenuItem per visible item. Default renders one from the item's data.
childrenReactNodeStatic children, e.g. CommandMenuEmpty.

API Reference: CommandMenuItem

PropTypeDefaultDescription
valuestringWhich item this row is. Its data fills the row; props below override it.
labelstringOverrides the item's label.
descriptionstringOverrides the item's description.
iconIconComponentOverrides the item's icon.
shortcutstringOverrides the item's shortcut caps.
disabledbooleanOverrides the item's disabled state.
onSelect() => voidOverrides the item's onSelect.
childrenReactNodeReplaces the label and description. The icon and caps stay.

API Reference: CommandMenuFooter

PropTypeDefaultDescription
hints{ label: string; keys: string | string[] }[]Replaces the default hints. A keys list draws 1 cap per entry.
childrenReactNodeReplaces the hints with your own content.

API Reference: CommandMenuShortcut

PropTypeDefaultDescription
keysstring | string[]The combo, in the trigger syntax ("mod+shift+p") or pre-formatted ("⌘⇧P"). A list draws 1 cap per entry. Modifiers draw as symbols on a Mac and words elsewhere.