Command
Command menu for search and quick actions.
About
Installation
pnpm dlx cubix@latest add command --base radixUsage
import {
Command,
CommandDialog,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut,
} from "@/components/cubix/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>Composition
Use the following composition to build a Command:
Command
├── CommandInput
└── CommandList
├── CommandEmpty
├── CommandGroup
│ ├── CommandItem
│ └── CommandItem
├── CommandSeparator
└── CommandGroup
├── CommandItem
└── CommandItemExamples
Basic
A simple command menu in a dialog.
Command Palette
Search for a command to run...
Shortcuts
Command Palette
Search for a command to run...
Groups
A command menu with groups, icons and separators.
Command Palette
Search for a command to run...
Scrollable
Scrollable command menu with multiple items.
Command Palette
Search for a command to run...
API Reference
Note: See the cmdk documentation for more information.
Command
The root that provides search context to input, list, and items.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Additional Tailwind classes merged with the component styles (last one wins). |
| children | React.ReactNode | - | CommandInput and CommandList. |
CommandDialog
Wraps Command in a dialog for a palette overlay.
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | - | Controlled open state of the dialog. |
| onOpenChange | (open: boolean) => void | - | Called when the open state changes. |
| title | string | "Command Palette" | Accessible title, visually hidden. |
| description | string | "Search for a command to run..." | Accessible description, visually hidden. |
| showCloseButton | boolean | false | Show the dialog close button. |
CommandInput
| Prop | Type | Default | Description |
|---|---|---|---|
| placeholder | string | - | Placeholder text for the search field. |
| value | string | - | Controlled search value. |
| onValueChange | (search: string) => void | - | Called when the search value changes. |
CommandGroup
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | - | Optional group label. |
CommandItem
| Prop | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | - | Disable the item. |
| onSelect | (value: string) => void | - | Called when the item is selected. |
| value | string | - | Search value. Defaults to the item text. |