No results found.
Calendar
Search Emoji
Calculator
Profile⌘P
Billing⌘B
Settings⌘S
Installation
npx logic2b@latest add commandUsage
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
} from "@/components/ui/command"
<Command>
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Suggestions">
<CommandItem>Calendar</CommandItem>
</CommandGroup>
</CommandList>
</Command>
CommandDialog
Use CommandDialog to render the command menu inside a modal (cmd+k style).
It depends on the dialog component.
import { CommandDialog, CommandInput, CommandList } from "@/components/ui/command"
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandInput placeholder="Type a command or search..." />
<CommandList>...</CommandList>
</CommandDialog>
API
Built on cmdk. Props flow through to the underlying primitives.
| Prop | Type | Default |
|---|---|---|
shouldFilter (Command) |
boolean — filter items automatically as you type |
true |
filter (Command) |
(value, search, keywords) => number — custom scoring |
— |
value / onValueChange (Command) |
string / (value: string) => void — control the highlighted item |
— |
value (CommandItem) |
string — value used for filtering |
text content |
onSelect (CommandItem) |
(value: string) => void |
— |
disabled (CommandItem) |
boolean |
false |
title / description (CommandDialog) |
string — accessible labels for the dialog |
Command Palette / Search for a command to run... |
showCloseButton (CommandDialog) |
boolean |
true |
Examples
With Icons
No results found.
Calendar
Search Emoji
Profile⌘P
Billing⌘B
Settings⌘S
Command Dialog
Render the menu inside a modal and toggle it with a keyboard shortcut.
Press
⌘J
or .Command Palette
Search for a command to run...
Accessibility
- Fully keyboard driven: the arrow keys move between items,
Enterruns the highlighted item, andHome/Endjump to the ends of the list. CommandInputis a combobox that owns the list viaaria-activedescendant, so focus stays in the input while items are announced as active.CommandDialogtraps focus, closes onEscape, and ships ansr-onlytitle and description so screen readers announce the palette on open.