Command Palette

Cmd K style command palette in a dialog with a search field that filters commands as you type, runs the chosen action and closes. Shows an empty state.

src/registry/ui/command-palette.tsx/r/command-palette.json

Installation#

bash
npx shadcn@latest add @minidev/command-palette

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/command-palette.json

Usage#

tsx
import { CommandPalette } from "@/components/ui/command-palette"

export function Example() {
  return (
    <CommandPalette open={cmd} onOpenChange={setCmd} commands={[{id:"1",label:"Go to users"},{id:"2",label:"Open settings"},{id:"3",label:"Invite member"}]} />
  )
}

API reference#

CommandPalette props
PropTypeDefault
openboolean-
onOpenChange(open: boolean) => void-
commandsCommand[]SAMPLE_COMMANDS
triggerReact.ReactNode-

Dependencies#

npm

lucide-react

Built from

Examples#

All navigation components

Learn more