Command
A command palette for fast keyboard-driven navigation and search, featuring grouped results, fuzzy matching, and keyboard shortcuts.
Preview
No results found.
Manali
Rishikesh
Goa
Jaipur
Search Hostels⌘K
My Bookings⌘B
View Map⌘M
Usage
tsx
import {
Command,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
CommandSeparator,
CommandShortcut,
} from "zostel-ui";
<Command>
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Destinations">
<CommandItem>Zostel Manali</CommandItem>
<CommandItem>Zostel Jaipur</CommandItem>
<CommandItem>Zostel Goa</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Actions">
<CommandItem>New Booking</CommandItem>
<CommandItem>View Profile</CommandItem>
<CommandItem>Settings</CommandItem>
</CommandGroup>
</CommandList>
</Command>Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled value of the selected command item |
onValueChange | (value: string) => void | — | Callback when the selected value changes |
filter | (value: string, search: string) => number | — | Custom filter function for command items. Return 1 for match, 0 for no match |
loop | boolean | false | Whether keyboard navigation loops from last item to first |
valueType:
stringDefault: —
Controlled value of the selected command item
onValueChangeType:
(value: string) => voidDefault: —
Callback when the selected value changes
filterType:
(value: string, search: string) => numberDefault: —
Custom filter function for command items. Return 1 for match, 0 for no match
loopType:
booleanDefault: false
Whether keyboard navigation loops from last item to first