CommandDialog wraps Command in a Base UI Dialog so the palette can be
toggled with a keyboard shortcut and rendered as a modal overlay. Because the
dialog unmounts its content on close, filter and highlight state reset for
free every time it reopens.
Wraps Command in the Dialog component with
sr-only title and description.
Prop
Type
Default
title
string
"Command Palette"
description
string
"Search for a command to run..."
showCloseButton
boolean
false
className
string — on the DialogContent
—
Data-driven filtering (intentional divergence from cmdk). cmdk filters by
reading each item’s rendered DOM text. Command instead filters the items
array you pass to the root — CommandList and CommandGroup take a
function child ((item) => ReactElement) that Base UI calls once per
item currently matching the input value, rather than a plain node. Items use
the { value, label } shape; the default filter is a locale-aware substring
match against .label. Pass a custom filter function for fuzzy matching,
or filter={null} together with a filteredItems prop to drive results from
an async search yourself.
Keyboard model. Virtual focus never leaves the input — the highlighted
item is tracked via aria-activedescendant, not real DOM focus. Arrow keys
move the highlight, Enter activates the highlighted item’s onClick, and
inside CommandDialog, Escape closes the dialog (inline Autocomplete mode
disables Base UI’s own dismissal so the keypress bubbles up to the Dialog
root).
The component ships with unit tests covering rendering, filtering, the empty
state, and keyboard activation — see packages/registry/tests/command.test.tsx.
Component
Renders
Command
Autocomplete.Root (inline open autoHighlight="always" keepHighlight) plus a styled container
CommandInput
Autocomplete.Input inside an Input Group with a trailing search-icon addon
CommandList
Autocomplete.List — takes a function child, one call per group/item