Command palette on cmdk and Radix Dialog: the search field morphs into the palette, results cascade by group and a pill highlight stretches across groups.
Use the shortcutTap to open
WWorkspace
AR
Revenue
€48,210
+4.1% vs last month
Orders
1,284
+2.6% vs last month
Refunds
€1,032
−0.8% vs last month
Latest orders
No recent activity
#1042
Order A
Paid
€320.00
#1041
Order B
Pending
€86.40
#1040
Order C
Paid
€1,210.00
command-palette · , lively
command-palette-demo.tsx
When to use
Use it as the Cmd+K entry point of a dashboard or back-office tool to search, jump and run actions from one field. Supports groups, nested pages, shortcuts and server-side search with a loading state.
When not to use
To pick one value for a form field use Combobox. For a short list of actions with no filter use Dropdown Menu.
Use it as the ⌘K entry point of a dashboard or back-office tool: search records, jump to pages and run actions from one field, with groups, recent items, nested pages ("Assign to…") and shortcuts. To pick one value for a form field, use the combobox; for a short list of row actions without filtering, a dropdown menu is lighter. The verbs preset is for row action lists long enough to need a filter.
The motion follows the three beats. Pressing the search field in the header charges: it sinks. The field's surface then acts: it morphs into the palette, opaque from its first frame, carrying the field's icon and placeholder in its input row while the overlay fades in; the field itself keeps its text. It settles as the results cascade in by group and a pill sits under the highlighted row; the pill glides one row at a time and stretches when the arrow keys jump across a group heading. Typing filters with a calm reflow and the palette's height follows the results on the calm spring, its footer riding on the bottom edge. A nested page replaces the list in place, sliding in from the right, while the page pill at the top stretches to take its name and the text after it moves with its edge; going back, the pill shrinks away. Running a command sinks its row; closing, the rows clear first, then the palette contracts back into the field and its input row lands on the field's icon and placeholder. Opened by the shortcut with no trigger in view, the palette rises from the top instead: a morph needs an origin. calm shortens and quiets all of this, playful moves more; the palette never bounces.
open, search, value (the highlighted row) and pages are each controlled or uncontrolled. shortcut sets the global toggle ("mod+k" by default, false for none); with two palettes on a page the last mounted one owns it. An item's onSelect runs after the row's charge, as the palette starts contracting; closeOnSelect={false} keeps the palette open. For server-side search set shouldFilter={false} and loading while a request runs; CommandPaletteError shows a failed source. useCommandPalette() opens the palette or pushes a page from anywhere inside it.
Pick a layout with preset (spotlight, inline, verbs) and a density with size (sm, md). The motion is the same in every preset. Set the character app-wide with MotionKitProvider, or per palette with temperament.
The inline preset hangs from the navbar's search field: the field grows down into a short result list, as wide as the field (at least 360 px), with a light overlay. Typing also queries a forum that is down: loading shows placeholder rows while it runs, then the matching docs pages and a CommandPaletteError row.
Use the shortcutTap to open
Docs
Guides
Getting started
Placeholder text for the page body. Search jumps to any guide or component page; the field grows into the list and folds back once you pick one.
The verbs preset is a short verb list anchored under the row's "Actions" button, with a filter input, a nested "Assign to…" page and the destructive verb last after a hairline. Its trigger is your own button through asChild.
The palette is a Radix Dialog (role="dialog", aria-modal when modal), named by a visually hidden title from CommandPaletteContent's aria-label (default "Command palette"). Focus moves to the input on open and returns to the trigger as soon as closing starts (unless the palette closed because focus moved elsewhere, where it stays).
The trigger is a button with aria-haspopup="dialog", aria-expanded and aria-keyshortcuts="Meta+K Control+K", named by its placeholder.
cmdk provides the input as a combobox with aria-activedescendant, the list as a listbox (aria-busy while loading), groups as groups labelled by their heading and rows as options with aria-selected and aria-disabled.
A polite live region announces the result count once typing pauses (0.3 s), "No results", "Searching…" and the title of a page entered.
The overlay, the highlight pill, the flying copy of the trigger, icons and key chips are aria-hidden. When the last input was the keyboard the pill carries a ring-tinted rim, so the highlighted row is visible at 3:1.
Rows are 36 px tall (32 px at sm, 44 px on touch screens). Text uses foreground, accent-foreground on the highlight and muted-foreground on popover for headings and key chips, AA in both themes.
With reduced motion (the OS setting, or MotionKitProvider reducedMotion="always") nothing sinks and nothing morphs: the trigger stays still and the palette fades in at its final place with the overlay, the rows fade in together, the highlight pill glides between rows without stretching, a nested page crossfades and closing fades the palette out in place. The open palette is the same picture as the morph's last frame, and every key works the same.
The morph is one layout animation of the palette's surface (transform), with the content counter-scaled so text never stretches; rows, the pill and the overlay animate transform and opacity. The highlight pill's height, the page pill's width and the list's height are the layout properties animated, each on a single element.
Nothing runs at rest: no loop to pause off-screen or in a hidden tab. The palette's content mounts only while open; the global shortcut is one keydown listener per palette.
Third-party dependencies, measured apart and shared with the combobox: cmdk, @radix-ui/react-dialog, @radix-ui/react-slot and motion. Most shadcn projects with MotionKit already ship all of them.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, @radix-ui/react-dialog, @radix-ui/react-slot, motion.
Dependencies
@radix-ui/react-dialog · peer
@radix-ui/react-slot · peer
cmdk
motion · peer
Triggers
a keyboard shortcut, click, typing, press
Reduced motion
No sink or morph: the palette fades in at its final place, rows fade in together, the pill glides without stretching, pages crossfade and closing fades out in place.
Keyboard
⌘K / Ctrl+K
Opens the palette (morphing out of a visible trigger, rising from the top otherwise); closes it when open
Enter / Space on the trigger
Opens the palette out of the trigger
Typing
Filters the rows; the best match is highlighted
ArrowDown / ArrowUp (Ctrl+N / Ctrl+P)
Next / previous enabled row; the pill glides, and stretches across a group heading
Alt + ArrowDown / ArrowUp
First row of the next / previous group
Home / End
First / last row
Enter
Runs the highlighted row (it sinks, then the palette contracts into the trigger) or opens its nested page
Backspace (empty query)
Goes up one page
Escape
Goes up one page; on the root page closes the palette
Tab
Stays inside the dialog
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)