Navigation
Command Palette Dialog
The command palette in a modal, toggled with ⌘K / Ctrl+K. Full screen on phones.
Last chosen: nothing yet
Installation
Install the package (React 19):
terminal
terminal
terminal
Import the styles once, in your app entry or root layout:
/src/main.tsx
Use it anywhere inside your app's <Theme> (see Installation):
/src/CommandPaletteDialogExample.tsx
Examples
Search dialog
Last chosen: nothing yet
With preview pane
Wide screens show the highlighted item on the right.
Last chosen: nothing yet
API Reference
CommandPaletteDialog
Accepts every CommandPalette prop, plus:
| Prop | Type | Default |
|---|---|---|
open | boolean | |
defaultOpen | boolean | false |
onOpenChange | (open: boolean) => void | |
hotkey | boolean | true |
width | number | 640 (1006 with preview) |
height | number | |
title | string | "Command palette" |
groups | { label: string; items: CommandItem[] }[] | |
onSelect | (item: CommandItem) => void | |
placeholder | string | "Search…" |
inputLabel | string | |
emptyText | ReactNode | "No results" |
filters | { label: string; icon?: IconName; menu?: boolean; muted?: boolean; onClick?: () => void }[] | [] |
hints | { keys: ReactNode; label: string }[] | ↑↓ Navigate, ↵ Select, esc Close |
preview | boolean | false |
defaultSelectedId | string | |
query | string | |
onQueryChange | (query: string) => void | |
autoFocus | boolean | false |
headerEnd | ReactNode |
Accessibility
- A WAI-ARIA modal dialog (named "Command palette" by default) containing the combobox: focus goes to the search input on open and is trapped in the dialog.
- ⌘K / Ctrl+K toggles it (when
hotkeyis on); Escape or a click outside closes it; focus returns to where it was. - The input is a WAI-ARIA combobox (
aria-expanded,aria-controls,aria-autocomplete="list",aria-activedescendant) controlling an always-visible listbox; focus stays in the input. - Typing filters by title, keywords and path (every word must match). ↑/↓ move the highlight, Ctrl+Home / Ctrl+End jump to the ends, Enter runs the highlighted item.
- Groups are labelled
groups; options exposearia-selectedfor the highlighted one; disabled items are skipped. - When nothing matches, the empty text is announced through a status region.
- Under 640px it fills the screen; the result list scrolls inside. Opens and closes with the shared motion layer (
styles/motion.css); withprefers-reduced-motion: reduceit only fades.
Usage
- Use as the app-wide search and command launcher, opened from a search button and ⌘K.
- Selecting an item calls
onSelectand closes the dialog: navigate or run the command there. - Turn
hotkeyoff when another part of the page already owns ⌘K.
© 2026 Motion. Internal documentation.