Skip to content

Command Palette

The Command Palette is a centered overlay with a search input, a scrollable body for results or commands, optional footer hints, and a trigger element that opens the dialog. Press ⌘K (macOS) or Ctrl+K (Windows/Linux) to toggle the palette when the page is focused.

Loading Code Block...
Loading Code Block...

Set showFooter to show keyboard hint copy (navigate with arrows, confirm with Enter) at the bottom of the modal.

Loading Code Block...
Loading Code Block...

The body can be any tree: grouped commands, highlighted rows, or an empty state.

Loading Code Block...
  • ⌘K / Ctrl+K toggles open and closed (when the window receives the key event).
  • Escape closes the palette.

Tip: focus this page, then press ⌘K (or Ctrl+K) to toggle.

Loading Code Block...
  • Provide a trigger that is a real button or focusable control when possible; read-only inputs are used in marketing patterns but are weaker for keyboard-only users opening the surface.
  • Keep result rows as semantic button elements or links with clear labels when items are selectable.
  • The overlay should trap focus inside the dialog for full WCAG compliance—the built-in implementations focus on layout and search; verify focus trap if you have strict compliance targets.