--- title: Command description: Fast, composable, unstyled command menu for React. component: true --- ## About The `` component uses the [`cmdk`](https://cmdk.paco.me) component by [pacocoursey](https://twitter.com/pacocoursey). ## Installation ```bash npx shadcn-ui add command ``` Manual Installation 1. Install the `cmdk` package: ```bash npm install cmdk ``` 2. The `` component depends on the `` component. Follow the [Dialog installation instructions](/docs/primitives/dialog#installation). 3. Copy and paste the following code into your project. This is the `` primitive. You can place it in a file at `components/ui/command.tsx`. ## Usage ```tsx import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, } from "@/components/ui/command" ``` ```tsx No results found. Calendar Search Emoji Calculator Profile Billing Settings ``` ## Examples ### Dialog To show the command menu in a dialog, use the `` component. ```tsx export function CommandMenu() { const [open, setOpen] = React.useState(false) React.useEffect(() => { const down = (e: KeyboardEvent) => { if (e.key === "k" && e.metaKey) { setOpen((open) => !open) } } document.addEventListener("keydown", down) return () => document.removeEventListener("keydown", down) }, []) return ( No results found. Calendar Search Emoji Calculator ) } ``` ## Combobox You can use the `` component as a combobox. See the [Combobox](/docs/components/combobox) page for more information.