Combo Boxes
Combobox is a Picker you can type in. It has the same trigger as SelectTrigger and opens a list with a search box. Typing narrows the list to every option whose text contains what was typed, anywhere in it: “ton” finds “Hampton Inn” and “Boston Heights”. The search reads the label a person sees, never the value (an id).
Use it for a dropdown over a list of records: a Job, a client, a contact, a person, a vendor, an SOV item, an Item. A short fixed list such as a status or a type stays a Select.
Live demo
The component below is the real one the app ships. Type “ton” in the list.
The Command list it is built on, shown on its own, and the older Popover composition:
Usage
Source:
Combobox.tsx
import { Combobox, Label } from "@beacon/design-system";
<Label htmlFor="job">Job</Label><Combobox id="job" options={jobs.map((j) => ({ value: j.id, label: j.name }))} value={jobId} onValueChange={setJobId} placeholder="Pick a Job" noneLabel="No Job"/>| Prop | Role |
|---|---|
options | { value, label }[]. The search matches label. |
value / onValueChange | As on Select. "" is no selection. |
placeholder, searchPlaceholder, emptyMessage | Trigger text, search box text, text when nothing matches. |
noneLabel | Adds a first entry with this label that clears the value. |
id | On the trigger, so Label htmlFor reaches it. |
disabled, className | As on SelectTrigger. |
The list opens above a modal or Fly-In. Arrows and Enter move and choose; Esc closes only the list; a second click on the trigger closes it. At 390px the trigger is at least 44px tall.
Source:
command.tsx,popover.tsx
The Command searchable list on its own:
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList,} from "@beacon/design-system";
<Command className="rounded-lg border shadow-md w-[350px]"> <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></Command>The composition Combobox is built from, for a picker that needs more than one value or custom rows: Command inside a Popover, with a trigger that reflects the selection. For several values use MultiSelect.
import { Button, Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, Popover, PopoverContent, PopoverTrigger,} from "@beacon/design-system";
const [open, setOpen] = React.useState(false);const [value, setValue] = React.useState("");
<Popover open={open} onOpenChange={setOpen}> <PopoverTrigger asChild> <Button variant="outline" role="combobox" aria-expanded={open}> {value || "Select framework..."} </Button> </PopoverTrigger> <PopoverContent className="w-[200px] p-0"> <Command> <CommandInput placeholder="Search framework..." /> <CommandList> <CommandEmpty>No framework found.</CommandEmpty> <CommandGroup> <CommandItem onSelect={(v) => { setValue(v); setOpen(false); }}> Next.js </CommandItem> <CommandItem onSelect={(v) => { setValue(v); setOpen(false); }}> Remix </CommandItem> </CommandGroup> </CommandList> </Command> </PopoverContent></Popover>Parts
Combobox is assembled from these exports.
| Part | Role |
|---|---|
Command | Root searchable list. Filters its items as the input changes (cmdk). |
CommandInput | The search field at the top (renders a search icon). |
CommandList | Scroll container for the results. |
CommandEmpty | Shown when no item matches the query. |
CommandGroup | Groups items under an optional heading. |
CommandItem | A selectable row; use onSelect to capture the choice. |
CommandSeparator | Divider between groups. |
CommandShortcut | Right-aligned hint text (e.g. a keyboard shortcut) inside an item. |
CommandDialog | Variant that renders the command list inside a centered dialog (command-palette style). |
Popover / PopoverTrigger / PopoverContent | Wrap Command to turn it into a field that opens on click. Use PopoverContent className="w-[...] p-0". |
When to use
- A dropdown over records (a Job, a client, a vendor, an Item) where typing to filter is faster than scrolling.
- An app-wide command palette (use
CommandDialog). - Autocomplete fields where the user selects from a known set.
Do not reach for this pattern when the list is short and fixed; a plain Picker is simpler and needs no filtering. For free-text entry that is not constrained to a list, use a text Input instead.