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

Default

<CommandPalette 
  isOpen={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

Sortable data table
PropTypeDefaultDescription
commands{ label: string; action: () => void; icon?: React.ReactNode; }[]-Array of command objects. Each command contains a label, an action callback, and an optional icon.
placeholderstring"Search..."Placeholder text for the search input field.
isOpenboolean-Controls whether the command palette is visible.
onClose() => void-Callback triggered when the palette should close.
asyncSearch(query: string) => Promise<{ label: string; action: () => void; icon?: React.ReactNode; }[]>-Optional asynchronous search function for dynamic filtering.
debounceMsnumber300Debounce delay in milliseconds for async search queries.
theme"primary" | "secondary" | "tertiary" | "quaternary" | "clear"Configured DefaultTheme variant for the command palette.
rounding"none" | "small" | "medium" | "large"Configured Default"Rounding style for the command palette container.
shadow"none" | "light" | "medium" | "strong" | "intense"Configured DefaultShadow intensity for the command palette container.
state"" | "success" | "error" | "warning"-Visual state variant, such as error or focus indicators.
data-testidstring"command-palette"Test ID for targeting the component in tests.
classNamestring-Additional CSS class names for the palette container.