apps/v4/content/docs/components/base/command.mdx
<ComponentPreview styleName="base-nova" name="command-demo" align="start" previewClassName="h-[24.5rem]" />
The <Command /> component uses the cmdk component by Dip.
npx shadcn@latest add command
<Step>Install the following dependencies:</Step>
npm install cmdk
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="command" title="components/ui/command.tsx" styleName="base-nova" />
<Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </CodeTabs>import {
Command,
CommandDialog,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut,
} from "@/components/ui/command"
<Command className="max-w-sm rounded-lg border">
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Suggestions">
<CommandItem>Calendar</CommandItem>
<CommandItem>Search Emoji</CommandItem>
<CommandItem>Calculator</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Settings">
<CommandItem>Profile</CommandItem>
<CommandItem>Billing</CommandItem>
<CommandItem>Settings</CommandItem>
</CommandGroup>
</CommandList>
</Command>
A simple command menu in a dialog.
<ComponentPreview styleName="base-nova" name="command-basic" />A command menu with groups, icons and separators.
<ComponentPreview styleName="base-nova" name="command-groups" />Scrollable command menu with multiple items.
<ComponentPreview styleName="base-nova" name="command-scrollable" />To enable RTL support in shadcn/ui, see the RTL configuration guide.
<ComponentPreview styleName="base-nova" name="command-rtl" direction="rtl" align="start" previewClassName="h-[24.5rem]" />
See the cmdk documentation for more information.