Command Palette

The Command Palette component allows users to quickly find and execute commands via keyboard navigation or search, with optional async search support.

Usage & Examples

Default

default.tsx
<CommandPalette 
    open={isOpen}
    onClose={() => setIsOpen(false)}
    commands={[
      { label: "Open Dashboard", action: () => alert("Dashboard opened") },
      { label: "View Settings", action: () => alert("Settings opened") },
      { label: "Log Out", action: () => alert("Logged out") },
    ]}
  />

Props API

27 props
Columns
Command Palette props API
Default
Description
asyncSearch((query: string) => Promise<CommandItem[]>)NoeventsCallback to handle the search input asynchronously.
classNamestringNostylingCustom classname for the command palette.
commandsCommandItem[]YespropsArray of available command options.
data-testidstringNotestingBackward-compatible alias for test ID attributes.
debounceMsnumberNoprops300Optional debounce time (in ms) for the search input.
emptyMessagestringNoprops"No matching results"Message announced when there are no matching commands.
inputAriaDescribedBystringNopropsAccessible description reference for the search input.
inputAriaLabelstringNopropsAccessible label for the search input.
inputAriaLabelledBystringNopropsAccessible label reference for the search input.
inputIdstringNopropsOptional ID for the input element.
inputLabelstringNopropsOptional visible or screen-reader-only label for the input.
listAriaLabelstringNoprops"Command suggestions"Accessible label for the command results list.