Skip to content

Command palette

⌘K launcher with fuzzy search, grouped results, sub-palettes, and a morphing highlight pill. Zero external deps — rAF spring entrance, cursor-mapped pastel indicator, colourField scrim behind backdrop blur.

  • Spring Physics
  • requestAnimationFrame
  • Fuzzy Match
  • Portal
  • pastelColour
live

command palette

Press ⌘K

Try typing, arrow keys, ⌘1 to fire the first match.

Usage

Drop it in

import
import { CommandPalette } from "@/app/lib/components/command-palette";

API

Props

PropTypeDefault
open*

Controlled open state

boolean—
onOpenChange*

Open state setter — called on esc, outside click, and after invocation

(open: boolean) => void—
commands*

Commands to show. Each can have `children` to push a nested palette

Command[]—
placeholder

Placeholder for the search input

string"Type a command…"
recents

IDs of recently-used commands — shown at top when query is empty

string[]—
emptyLabel

Label for the empty state

string"No results"
loading

Show 3 skeleton rows instead of results

booleanfalse
triggerKey

Trigger key combo for window-level open. Default: ⌘K / Ctrl+K

{ key: string; meta?: boolean }{ key: "k"

Read from the component's source at build time. * required.

Accessibility

Works with

Cursor
Reacts to where the pointer is, not just whether it's over the element.
Touch
Follows your finger while it's down, then settles a moment after you lift.
Keyboard
Focus lights it up the way the cursor does. Every action has a key.
Reduced motion
Nothing moves or springs. Colour still answers, without drifting.