Get Started
Form
Components
- Accordion
- Alert
- Alert Dialog
- Badge
- Breadcrumbs
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- File Field
- Hover Card
- Kbd
- Menubar
- Navigation Menu
- Number Field
- OTP Field
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Search
- Segmented Control
- Select
- Separator
- Sidebar
- Skeleton
- Slider
- Sonner
- Switch
- Table
- Tabs
- Text Field
- Toggle Group
- Toggle Button
- Tooltip
Component command-demo not found in registry.
Installation
Install the following dependencies:
Copy and paste the following code into your project:
Usage
import {
Command,
CommandDialog,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut,
} from "@/components/ui/command"<Command>
<CommandInput />
<CommandList>
<CommandEmpty />
<CommandGroup>
<CommandItem />
<CommandItem />
<CommandItem />
</CommandGroup>
<CommandSeparator />
<CommandGroup>
<CommandItem />
<CommandItem />
<CommandItem />
</CommandGroup>
</CommandList>
</Command>Examples
Dialog
Component command-dialog-demo not found in registry.
To show the command menu in a dialog, use the <CommandDialog /> component.
export function CommandMenu() {
const [open, setOpen] = createSignal(false)
const down = (e: KeyboardEvent) => {
if (e.key === "j" && (e.metaKey || e.ctrlKey)) {
e.preventDefault()
setOpen((open) => !open)
}
}
createEffect(() => {
document.addEventListener("keydown", down)
onCleanup(() => {
document.removeEventListener("keydown", down)
})
})
return (
<CommandDialog open={open()} onOpenChange={setOpen}>
<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>
</CommandList>
</CommandDialog>
)
}