Umbra UI

CommandPalette

A ⌘K command menu with search, groups and keyboard navigation.

Animatedimport { CommandPalette } from 'umbra-ui/motion'

Props

PropTypeDefaultDescription
items requiredCommandItem[]—Commands to search.
closeOnSelect booleantrueClose after an item is chosen.
defaultOpen booleanfalseInitial open state when uncontrolled.
emptyMessage ReactNodeNo results.Shown when nothing matches.
hotkey booleantrueToggle with ⌘K / Ctrl+K from anywhere on the page.
label stringCommand paletteAccessible name of the dialog and the result list.
onOpenChange ((open: boolean) => void)—Called when the palette opens or closes.
onSelect ((item: CommandItem) => void)—Called with the chosen item, after its own `onSelect`.
open boolean—Controlled open state.
placeholder stringType a command or search…Search field placeholder.
reducedMotion "system" | "always" | "never""system"Reduced-motion override. Under reduced motion the palette fades without scaling.

Usage notes

Filtering is a case-insensitive match of every search term against label, group and keywords.

Accessibility

  • A modal dialog: focus is trapped, and restored to the previously focused element on close.
  • The search field is a combobox controlling a listbox; the active option is tracked with aria-activedescendant.
  • ↑/↓ move (wrapping, skipping disabled), Home/End jump, Enter runs, Escape closes, ⌘K / Ctrl+K toggles.
  • The number of results is announced politely.

Import

import { CommandPalette } from 'umbra-ui/motion';
import 'umbra-ui/styles.css'; // once, at the root of your app