Actions & Navigation

Command

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
valuestringValue used for filtering (defaults to text content)
keywordsstring[]Additional keywords used when filtering
onSelect(value: string) => voidCalled when the item is selected

CommandDialog#

NameTypeDescription
isOpenbooleanWhether the dialog is open
onOpenChange(open: boolean) => voidCalled when the open state changes