Forms
Combobox
A searchable select with autocomplete. It is a controlled component, so hold the chosen value in state.
Purpose
Reach for a combobox once a Select list is long enough that scanning it is slower than typing. For several choices at once use Multi-select.
Example
const [clinic, setClinic] = React.useState("");
<Combobox
options={CLINIC_OPTIONS}
value={clinic}
onValueChange={setClinic}
placeholder="Select a panel clinic…"
searchPlaceholder="Search clinics…"
emptyText="No matching clinic."
/>States
- Empty search — when the filter matches nothing, the list shows
emptyText(default "No results found."). Make it say what was searched over: "No matching clinic." — try typing nonsense in the example above. - Selected — the trigger shows the option's
label; the open list marks it with a--primarycheck. Selecting it again clears the value (onValueChangefires with""). - Disabled — there is none:
ComboboxPropsexposes nodisabled, so omit the control or render the value as text when it cannot be changed.
Structure
| Property | Value |
|---|---|
| Trigger | outline Button, 40px (h-10), full width, space-between |
| Trigger icon | 18px unfold_more glyph, --muted-foreground |
| Placeholder | --muted-foreground |
| Listbox | --popover surface, --radius-lg, --shadow-8, width matches the trigger |
| Selected mark | 16px check glyph in --primary |
| Search | text input pinned above the list |
Best practices
Do
- Use it for long, familiar lists — panel clinics, medications — where typing beats scrolling.
- Give it an accessible name: the
labelprop, or a visible<Label htmlFor>paired withid. - Write
emptyTextthat names the collection ("No matching clinic."), not a bare "No results". - Keep option
labels unique — they are what the filter searches.
Don't
- Use it for a handful of options — that is a Select or Radio group.
- Use it for several choices at once — that is Multi-select.
- Rely on the trigger text as the name — screen readers read it as the value, not the label.
Accessibility & keyboard
- The trigger needs a name. It carries
role="combobox", whose accessible name does not come from its own text — that text is read as the current value. Without a name, a screen reader announces the selected option with no indication of what it selects. Pass thelabelprop (it defaults to theplaceholdertext), or pair a visible<Label htmlFor>with theidprop and omitlabel. - The trigger exposes
aria-expanded; when the list opens, focus moves into the search input. - Esc closes the list and returns focus to the trigger.
- Keyboard: Enter or Space on the trigger opens; type to filter the options; ArrowUp/ArrowDown move through the matches; Enter selects the highlighted option and closes; Esc closes without changing the value.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
optionsrequired | ComboboxOption[] | — | Selectable options. `label` is displayed and searched; `value` is reported to `onValueChange`. |
value | string | undefined | — | The currently selected option's `value` (controlled). |
onValueChange | ((value: string) => void) | undefined | — | Called with the newly selected `value`, or an empty string when the current selection is toggled off. |
placeholder | string | undefined | "Select…" | Text shown on the trigger when nothing is selected. |
searchPlaceholder | string | undefined | "Search…" | Placeholder for the search input inside the dropdown. |
emptyText | string | undefined | "No results found." | Message shown when the search matches no options. |
className | string | undefined | — | Extra classes applied to the trigger button. |
id | string | undefined | — | `id` forwarded to the trigger button, for pairing with a `<Label htmlFor>`. |
label | string | undefined | the `placeholder` text | Accessible name for the trigger. The trigger carries `role="combobox"`, whose accessible name does *not* come from its own text — that text is read as the current value. Without a name, a screen reader announces the selected option with no indication of what it selects. Omit only when you have paired a visible `<Label htmlFor>` with `id`. |
Quantity toggle
A numeric stepper for small counted quantities such as claim line items or dependant counts. Arrow keys step, and values clamp to min and max.
Multi-select
Pick several options from a known list, with the chosen values shown as removable chips and an overflow count once they no longer fit.