About the shadcn/ui Command Component

The Command component is part of shadcn/ui — a collection of accessible, copy-paste React components built with Radix UI and Tailwind CSS. Install it with `npx shadcn@latest add command` and copy it directly into your project.

Command Component — Frequently Asked Questions

How do I open a shadcn Command Dialog with a keyboard shortcut?

Use `useEffect` with a `keydown` listener for `Meta+K` or `Ctrl+K`. Set `open` state to `true` and render `<CommandDialog open={open}>`. The Dialog example shows the complete pattern.

How do I add sections to a shadcn Command menu?

Use `<CommandGroup heading="Actions">` to group related items. Multiple groups display with their heading labels and visual separation.

How do I handle async search in shadcn Command?

Set `shouldFilter={false}` to disable built-in filtering. Implement your own `onValueChange` handler that calls an API and updates the items list based on the search query.

Command Component - shadcn/ui Examples | Shadcn Store