Actions & Navigation

Command

A command palette for searching and running actions with keyboard navigation.

A command palette for searching and running actions with keyboard navigation.

Dialog#

Use CommandDialog to display the command palette in a modal overlay. Control visibility with the isOpen and onOpenChange props.

Component props#

Command#

NameTypeDescription
valuestringControlled value of the selected item
onValueChange(value: string) => voidCalled when the selected item changes
filter(value, search, keywords) => numberCustom filter function for ranking items
shouldFilterbooleanDisable built-in filtering when false
loopbooleanLoop keyboard navigation from last item to first

CommandInput#

NameTypeDescription
placeholderstringInput placeholder text
valuestringControlled search value
onValueChange(search: string) => voidCalled when the search value changes

CommandGroup#

NameTypeDescription
headingReactNodeGroup heading displayed above items

CommandItem#

NameTypeDescription
iconReactNodeIcon displayed before the label
isDisabledbooleanDisables the item (disabled is also accepted)
valuestringValue used for filtering (defaults to text content)
keywordsstring[]Additional keywords used when filtering
onSelect(value: string) => voidCalled when the item is selected

CommandList#

NameTypeDescription
maxHeightstring | numberWraps the list in a ScrollArea capped at this height. Without it the list scrolls natively at max-h-[300px]

CommandShortcut#

Renders a right-aligned muted <span> for keyboard shortcut hints inside a CommandItem.

CommandDialog#

NameTypeDescription
openbooleanWhether the dialog is open (isOpen is an accepted alias)
onOpenChange(open: boolean) => voidCalled when the open state changes

Anatomy#

Every part exposes a data-slot attribute: command, command-input-wrapper, command-input, command-list, command-empty, command-group, command-separator, command-item, and command-shortcut. Inside CommandDialog the input wrapper grows to h-12.