CommandMenu is a search-driven command palette component.
CommandMenu requires a collection of options via the options property. Use group to display grouped commands with optionGroupLabel and optionGroupChildren.
CommandMenu requires a collection of options via the options property. Use group to display grouped commands with optionGroupLabel and optionGroupChildren.
A custom filter function can be provided with the filter property. The function receives the label, search term, and optional keywords, and should return a score (0 means no match).
The search value can be controlled with two-way binding using [(search)]. An empty template customizes the message when no results are found.
CommandMenu can be used inside a Dialog to create a command palette experience. Press Ctrl+K (or Cmd+K on Mac) to open.
Custom content can be displayed for each item using the item template.
The search input has a combobox role with aria-expanded, aria-controls and aria-activedescendant attributes. The list element uses the listbox role and each item has an option role. Value to describe the component can be provided via ariaLabel prop.
| Key | Function |
|---|---|
| down arrow | Moves focus to the next option. |
| up arrow | Moves focus to the previous option. |
| enter | Selects the focused option. |
| home | Moves focus to the first option. |
| end | Moves focus to the last option. |