Components
Command Menu
A search field over a list of actions. The input keeps focus while arrows move the highlight; Enter runs the row under it.
Usage
One app-wide palette for navigation and actions.
Do and don't
- Do. Mount one instance at the root and bind mod+k there.
- Don't. Use it as a form control or mount two competing palettes.
The demo disables the keyboard shortcut so it does not compete with the site's global palette. In an app, mount one CommandMenuDialog at the root and bind mod+k there.
Availability
This component powers the site's global palette and stays site-only on purpose. It is an app-level composition of Dialog, Tabs and Scroll Area, plus a global keyboard binding and a page index. Emitting it as a generic registry item would blur the line between a reusable component and an application pattern. Copy its source if you need a palette; the underlying primitives install today.
Composition
CommandMenuDialog supplies the modal shell. Inside it, CommandMenu owns the query and filtered list; CommandMenuInput, CommandMenuList, CommandMenuEmpty and CommandMenuFooter fill the slots. CommandMenuTabs and CommandMenuShortcut cover grouped views and key caps.
Props
CommandMenu:items,onSelect,filter,query/defaultQuery,suggestions,suggestionsLabel.CommandMenuItemData:value,label,description,group,keywords,icon,shortcut,onSelect.CommandMenuDialog:open,defaultOpen,onOpenChange,shortcut(defaultmod+k),shortcutScope,title,description,modal,container.
Behavior and states
The highlight starts on the first visible row, or on suggestions while the query is empty. Arrow keys move it and Enter runs it; the input stays focused the whole time and points at the row through aria-activedescendant. Keep the items array stable: changing it resets the highlight. An empty query with no matches renders CommandMenuEmpty.
Accessibility
The dialog owns focus while open and returns it on close. The list has no focus ring because focus never leaves the input; the hover highlight is the only moving indicator. Give the dialog a real title and description. Shortcut caps are display only: bind the actual key combination on the control that performs the action.
Responsive
The dialog inherits the Dialog widths and the shared size step. Keep row labels short enough to read on a phone; long descriptions can wrap.
Related
Dialog is the shell, Combobox is the form control alternative, and Motion & Transitions explains why this particular popup has no open animation.