Command palette
Cmd+K search dialog for tools, actions, and keyboard shortcuts. Built on cmdk and Radix Dialog.
Install
npx shadcn@latest add https://substrate.georgedrury.co.uk/r/command-paletteExamples
Default
"use client"
import { useState } from "react"Interaction
- ⌘K / Ctrl+K opens and closes the palette.
- Type to fuzzy-search across all items.
- Arrow keys to navigate, Enter to select.
- Escape to dismiss.
Components
| Component | Description |
|---|---|
CommandPalette | Dialog wrapper with ⌘K listener |
CommandInput | Search input with magnifying glass icon |
CommandList | Scrollable results container |
CommandEmpty | Shown when no results match |
CommandGroup | Labelled group of items |
CommandItem | Selectable result row |
CommandShortcut | Right-aligned keyboard shortcut hint |
CommandSeparator | Horizontal divider between groups |