Combobox
An autocomplete input that filters options as the user types.
An autocomplete input that filters options as the user types. Built with native elements and full ARIA attributes — no Base UI primitive (no such primitive exists for combobox).
Usage
Disabled
Set disabled to make the input non-interactive.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
options | ComboboxOption[] | — | List of options (required) |
value | string | — | Controlled selected value |
onValueChange | (value: string) => void | — | Called when option is selected |
inputValue | string | — | Controlled input value (for external filtering) |
onInputChange | (value: string) => void | — | Called on every keystroke |
placeholder | string | "Search…" | Input placeholder |
emptyMessage | ReactNode | "No options found." | Message when filter returns no results |
disabled | boolean | false | Disables the input |
labels | { trigger?: string } | — | Screen-reader text of the open button, for translation |
icons | { trigger?: ReactNode; selected?: ReactNode } | — | Replaces the built-in icons. See the Icons guide |
sx | StyleXStyles | — | StyleX override for the input |
Keyboard
| Key | Action |
|---|---|
↓ / ↑ | Navigate options |
Enter | Select highlighted option |
Escape | Close listbox |
Tab | Close listbox, move focus |
Any character | Filter options |
Accessibility
- Input has
role="combobox",aria-expanded,aria-controls,aria-activedescendant,aria-autocomplete="list" - Listbox has
role="listbox" - Each option has
role="option",aria-selected,aria-disabled - Focus never leaves the input — keyboard users navigate via
aria-activedescendant
Performance
For lists exceeding 100 items, use virtualization. The Combobox renders a filtered <ul> into the DOM on every keystroke — large unvirtualized lists cause measurable paint jank.
Virtualization
The Combobox component renders every matching option. For a list above 100 items, build your own combobox on Base UI Combobox with its virtualized prop, and render the rows with @tanstack/react-virtual. Base UI keeps aria-activedescendant, aria-setsize and aria-posinset correct for the rows that are not in the DOM. Do not hide the rows from assistive technology with aria-hidden.
For smaller lists, the built-in <Combobox> is the right choice.
Server-side filtering
For very large datasets (thousands of items), filter on the server instead:
const [query, setQuery] = useState('');
const [options, setOptions] = useState<ComboboxOption[]>([]);
// Debounce the API call
useEffect(() => {
const t = setTimeout(async () => {
if (query.length < 2) return;
const results = await api.search(query);
setOptions(results);
}, 300);
return () => clearTimeout(t);
}, [query]);
<Combobox
options={options}
inputValue={query}
onInputChange={setQuery}
aria-label="Search users"
/>;Theming
The sx prop overrides the input element. The listbox and options use internal StyleX styles that can be overridden by building a custom combobox using the same hook logic.