---import { CalculatorIcon, CalendarIcon, CreditCardIcon, SettingsIcon, SmileIcon, UserIcon } from '@lucide/astro';
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from '@bejamas/registry/ui/command';---
<Command class="max-w-sm rounded-lg border"> <CommandInput placeholder="Type a command or search..." /> <CommandList> <CommandEmpty>No results found.</CommandEmpty> <CommandGroup heading="Suggestions"> <CommandItem> <CalendarIcon /> <span>Calendar</span> </CommandItem> <CommandItem> <SmileIcon /> <span>Search Emoji</span> </CommandItem> <CommandItem disabled> <CalculatorIcon /> <span>Calculator</span> </CommandItem> </CommandGroup> <CommandSeparator /> <CommandGroup heading="Settings"> <CommandItem> <UserIcon /> <span>Profile</span> <CommandShortcut>⌘P</CommandShortcut> </CommandItem> <CommandItem> <CreditCardIcon /> <span>Billing</span> <CommandShortcut>⌘B</CommandShortcut> </CommandItem> <CommandItem> <SettingsIcon /> <span>Settings</span> <CommandShortcut>⌘S</CommandShortcut> </CommandItem> </CommandGroup> </CommandList></Command>Installation
Section titled “Installation”bunx bejamas add commandnpx bejamas add commandpnpm dlx bejamas add commandyarn dlx bejamas add command---import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut,} from '@bejamas/ui/components/command';import { Calculator, Calendar, CreditCard, Settings, Smile, User,} from '@lucide/astro';---
<Command class="max-w-sm rounded-lg border"> <CommandInput placeholder="Type a command or search..." /> <CommandList> <CommandEmpty>No results found.</CommandEmpty> <CommandGroup heading="Suggestions"> <CommandItem> <CalendarIcon /> <span>Calendar</span> </CommandItem> <CommandItem> <SmileIcon /> <span>Search Emoji</span> </CommandItem> <CommandItem disabled> <Calculator /> <span>Calculator</span> </CommandItem> </CommandGroup> <CommandSeparator /> <CommandGroup heading="Settings"> <CommandItem> <User /> <span>Profile</span> <CommandShortcut>⌘P</CommandShortcut> </CommandItem> <CommandItem> <CreditCard /> <span>Billing</span> <CommandShortcut>⌘B</CommandShortcut> </CommandItem> <CommandItem> <Settings /> <span>Settings</span> <CommandShortcut>⌘S</CommandShortcut> </CommandItem> </CommandGroup> </CommandList></Command>| Prop | Type | Default |
|---|---|---|
label |
string |
|
defaultValue |
string |
|
defaultSearch |
string |
|
shouldFilter |
boolean |
|
loop |
boolean |
|
disablePointerSelection |
boolean |
|
vimBindings |
boolean |
|
class |
string |
"" |
API Reference
Section titled “API Reference”Events
Section titled “Events”| Event | Detail | Description |
|---|---|---|
command:change |
{ value: string | null } |
Fired when the active item changes |
command:search-change |
{ search: string } |
Fired when the search query changes |
command:select |
{ value: string } |
Fired when an item is selected |
Programmatic Control
Section titled “Programmatic Control”const command = document.getElementById('my-command');
command.dispatchEvent(new CustomEvent('command:set', { detail: { search: 'settings', value: 'settings' }}));Dialog Composition
Section titled “Dialog Composition”<CommandDialog defaultOpen> <Command> <CommandInput placeholder="Search..." /> <CommandList> <CommandEmpty>No results found.</CommandEmpty> <CommandItem>Open settings</CommandItem> </CommandList> </Command></CommandDialog>