Combobox
Choose one collection item through an editable search input.
Use Combobox when users should type to find one item in a collection. Use Select for a non-editable choice and MultiSelect for multiple collection values.
Basic usage#
Playground#
Anatomy#
Combobox renders the portaled popup collection internally; its content and item names are style slots, rather than attached child parts.
Usage#
String items#
Pass strings when the label and value are identical. Strings and objects can be mixed at the root or inside a group. Whitespace is preserved, and an empty string is a valid value.
String items are converted to the same item shape used by callbacks: 'Apple' becomes
{ value: 'Apple', label: 'Apple' }. Object items retain their identity and custom fields.
ComboboxT.NormalizedItem<TItem> names the callback item type. Duplicate values use the first
occurrence, including collisions between strings and objects.
Value and query#
Pair value with onValueChange for controlled selection, or use defaultValue for an initial
uncontrolled choice. null means no selection; an empty string is a valid item value.
While open, the input displays the query; while closed, it displays the selected item label.
Arbitrary query text is never committed as a value. Use value / onValueChange for selection and
searchValue / onSearch for query text.
Pointer opening#
By default, clicking inside the input focuses the field without opening the popup immediately. The trailing
chevron button toggles the dropdown, while typing or pressing ArrowDown opens it. Set openOnControlClick={true}
if you want any click on the field to open the options list.
Keyboard interaction#
| Key | Behavior |
|---|---|
| ArrowDown / ArrowUp | Open the popup or navigate through matched options |
| Enter | Commit the currently highlighted option |
| Escape | Revert query text or close the dropdown |
| Home / End | Move text cursor within input (or navigate options when listbox is focused) |
Virtualization#
Add createListVirtualizer when rendering the full collection makes opening or scrolling slow.
Read the Virtualization guide for setup, row measurements, stable keys, and keyboard navigation.
Examples#
Basic autocomplete#
Custom and rich items#
Display status indicators, icons, and descriptions using icon and description.
User search#
Search teammates by name or email.
Filter strategies#
Configure how query text matches items using filterItem="contains" (default) or filterItem="startsWith".
Debounced remote search#
Simulate async fetching by combining searchValue, onSearch, and loading.
Groups and custom empty state#
Organize options into categories and customize the empty state when no matches exist.
Form integration#
Use form.Field from createForm when the selected value needs schema validation and error display.
Attributes#
data-closedSlot: combobox-control, combobox-contentDescription: Present when disclosure or transition content is closed.data-disabledSlot: combobox-control, combobox-itemDescription: Present when the component, slot, or item is disabled.data-editableSlot: combobox-controlDescription: Present when the value can be edited as text.data-expandedSlot: combobox-control, combobox-contentDescription: Present when the panel, accordion, or menu is expanded.data-invalidSlot: combobox-controlDescription: Present when the field or form has a validation error.data-readonlySlot: combobox-controlDescription: Present when the field is in read-only mode.data-requiredSlot: combobox-controlDescription: Present when the field input is required.data-sideSlot: combobox-contentDescription: Stores the resolved floating or drawer content side.data-highlightedSlot: combobox-item, combobox-item-descriptionDescription: Present when the item is highlighted by pointer or keyboard navigation.data-selectedSlot: combobox-itemDescription: Present when the item or tab is selected.data-loadingSlot: combobox-triggerDescription: Present when the component or async operation is loading.Props#
Renders a <div> element by default.