DS0
Components

CommandPalette

A ⌘K style command palette with search, grouping, and keyboard shortcuts.

Overview

CommandPalette provides a keyboard-driven command interface (⌘K / Ctrl+K). Users can search across commands, navigate with keyboard, and execute actions instantly.

Usage

<CommandPalette
  open={open}
  onOpenChange={setOpen}
  groups={[
    { heading: 'Navigation', items: [
      { label: 'Home', onSelect: () => router.push('/') },
      { label: 'Settings', onSelect: () => router.push('/settings'), shortcut: '⌘,' },
    ]},
    { heading: 'Actions', items: [
      { label: 'New Document', onSelect: handleNew, shortcut: '⌘N' },
    ]},
  ]}
/>

Accessibility

KeyAction
⌘K / Ctrl+KOpen palette
ArrowDown/UpNavigate items
EnterExecute selected command
EscapeClose palette

API Reference

PropTypeDefaultDescription
openbooleanControlled open state
onOpenChange(open: boolean) => voidOpen state callback
groupsCommandGroup[][]Grouped command items
placeholderstring'Type a command...'Search placeholder
ComponentWhen to Use Instead
ComboboxSelecting from a list
DropdownMenuSimple action menu
DialogGeneral modal overlay

On this page