Command
Filterable command palette with grouped actions.
Installation
Usage
Examples
With groups
Split actions into labelled groups with a separator.
With shortcuts
Hint at keyboard equivalents beside each action.
Disabled item
Items can be locked so they cannot be selected.
API reference
Command
| Prop | Type | Default |
|---|---|---|
labelAccessible label for the menu. Not shown visibly. | string | - |
shouldFilterSet to false to turn off automatic filtering and sort yourself. | boolean | true |
filterCustom match score from 0 (hidden) to 1 (best match). Defaults to the command-score filter. | (value: string, search: string, keywords?: string[]) => number | - |
defaultValueInitially selected item value when uncontrolled. | string | - |
valueControlled selected item value. Use with onValueChange. | string | - |
onValueChangeCalled when the selected item changes. | (value: string) => void | - |
loopLoop arrow key navigation around the ends of the list. | boolean | false |
disablePointerSelectionSet to true to disable selection via pointer events. | boolean | false |
vimBindingsSet to false to disable ctrl+n/j/p/k shortcuts. | boolean | true |
classNameAdditional classes merged with the default menu styles. | string | - |
CommandInput
| Prop | Type | Default |
|---|---|---|
valueControlled search text. Use with onValueChange. | string | - |
onValueChangeCalled when the search text changes. | (search: string) => void | - |
placeholderHint text shown while the search is empty. | string | - |
disabledDisable the search input. | boolean | false |
classNameAdditional classes merged with the default input styles. | string | - |
CommandList
| Prop | Type | Default |
|---|---|---|
labelAccessible label for the list of suggestions. Not shown visibly. | string | "Suggestions" |
classNameAdditional classes merged with the default list styles. | string | - |
CommandEmpty
| Prop | Type | Default |
|---|---|---|
childrenShown automatically when the search matches nothing. | ReactNode | - |
classNameAdditional classes merged with the default empty styles. | string | - |
CommandGroup
| Prop | Type | Default |
|---|---|---|
headingHeading rendered above the grouped items. | ReactNode | - |
valueUnique group value. Required when no heading is provided. | string | - |
forceMountAlways render the group even when filtering hides it. | boolean | - |
classNameAdditional classes merged with the default group styles. | string | - |
CommandItem
| Prop | Type | Default |
|---|---|---|
valueUnique value for the item. Inferred from the text content when omitted, so pass a stable value when the content changes between renders. | string | - |
keywordsExtra keywords matched against when filtering. | string[] | - |
onSelectCalled when the item is selected via click or keyboard. | (value: string) => void | - |
disabledDisable the item so it cannot be selected. | boolean | false |
forceMountAlways render the item even when filtering hides it. | boolean | - |
classNameAdditional classes merged with the default item styles. | string | - |
CommandSeparator
| Prop | Type | Default |
|---|---|---|
alwaysRenderAlways render the separator. By default it hides while searching. | boolean | - |
classNameAdditional classes merged with the default separator styles. | string | - |
CommandShortcut
| Prop | Type | Default |
|---|---|---|
classNameAdditional classes merged with the default shortcut hint styles. | string | - |