Skip to content

Combobox

A searchable input that selects and remembers one or more values.

The chatbot answers from this knowledge base.

hero.tsx

Usage guidelines

  • Use Combobox to select and remember one or more values from a searchable collection. Use Select to choose from a closed, scannable list without text entry, and Autocomplete for free-form text with optional suggestions, where the value is the typed text.
  • Give the input an accessible name. An input-based combobox inside a Field takes FieldLabel; a trigger-based combobox takes ComboboxLabel, and a popup that holds its own search input is named with aria-label.
  • Pass items to the root so filtering, typeahead and ComboboxValue share one source of truth. Keep the caller's value type with Combobox<Value, Multiple, Item>; in multiple mode the second generic is the literal true and matches multiple.
  • Use ComboboxClear to clear the selected value, in the input group outside the popup. When the search input sits inside the popup, do not add a control that clears the typed query: the popup resets the query itself, and a second clear button adds a tab stop that means something other than clearing the selection.
  • Render chips through ComboboxValue around ComboboxChips, and label the chips container only while it has chips and the toolbar role. Localize the chip's Backspace/Delete description, each ComboboxChipRemove name, and the input's selection count and Left Arrow hint.
  • The popup follows the anchor width and clamps to the viewport with Base UI's --anchor-width and --available-width. Do not replace that sizing with a fixed width.

Anatomy

tsx
tsx

Chips are for multiple selection only; a single combobox puts ComboboxInput directly in the input group. For a select-like field, render ComboboxLabel and a ComboboxTrigger with ComboboxValue and ComboboxIcon, and move the input group into ComboboxPopup.

Examples

Multiple selection with chips

Selected values render as chips that wrap inside the input group, and ArrowLeft from the start of the input moves focus onto them. The chip description, the remove button names and the selection hint in FieldDescription are your strings to localize.

Reviewers approve changes before the app is published. 2 selected. From the start of the input, press Left Arrow to focus the selected reviewers.

multiple-chips.tsx

Grouped options with live status

Pass grouped { label, items } objects to items and render them with ComboboxGroup, ComboboxGroupLabel, ComboboxSeparator and ComboboxCollection. ComboboxStatus announces the filtered result count as the user types.

Empty groups hide automatically as you filter.

groups.tsx

ID values with a popup search input

createComboboxItems keeps full records for the list while the value stays a stable ID. getLabel drives filtering and the trigger text. An unpublished app is a disabled item: it stays visible but cannot be chosen. ComboboxClear sits beside the trigger to clear the selected value, while the search input inside the popup has no clear button of its own.

Fallback app

Saved value: app_81c2

item-ids.tsx

Keyboard

KeyAction
Down arroworUp arrowOpens the popup from the input and moves the highlight between items.
EnterorDown arrowOpens the popup from a ComboboxTrigger and moves focus to its search input.
EnterSelects the highlighted item. In single mode it fills the input and closes the popup.
EscapeCloses the popup and restores the input. With the popup closed, clears the selected value.
Left arrowMoves focus from the start of the input to the last chip, then to the previous chip.
Right arrowMoves focus to the next chip, then back to the input.
BackspaceorDeleteRemoves the focused chip. Backspace in an empty input removes the last chip.

API reference

Combobox

Groups all parts of a filterable combobox for selecting one or multiple predefined options. Doesn't render its own HTML element.

Supports inline input triggers, popup search inputs via ComboboxTrigger, and external surfaces via inline.

Base UI Combobox.Root docs

ComboboxChip

An individual chip that represents a value in a multiselectable input. Renders a <div> element.

Base UI Combobox.Chip docs

Data attributes
AttributeDescription
data-disabled

Whether the component should ignore user interaction.

ComboboxChipRemove

A button to remove a chip. Renders a <button> element.

Base UI Combobox.ChipRemove docs

Data attributes
AttributeDescription
data-disabled

Whether the component should ignore user interaction.

ComboboxChips

A container for the chips in a multiselectable input. Renders a <div> element.

Base UI Combobox.Chips docs

ComboboxClear

Clears the value when clicked. Renders a <button> element.

Base UI Combobox.Clear docs

Props
PropTypeDefaultDetails
size'large' | 'medium' | 'small''medium'
Base UI Combobox.Clear docs
Data attributes
AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-disabled

Present when the button is disabled.

data-visible

Present when the clear button is visible.

data-starting-style

Present when the button begins animating in.

data-ending-style

Present when the button is animating out.

ComboboxCollection

Renders filtered list items. Doesn't render its own HTML element.

If rendering a flat list, pass a function child to the List component instead, which implicitly wraps it.

Props
PropTypeDefaultDetails
children required(item: Item, index: number) => React.ReactNodeNo default

ComboboxEmpty

Renders its children only when the list is empty. Requires the items prop on the root component. Announces changes politely to screen readers. This component's root element must remain mounted in the DOM to announce changes consistently across screen readers. Avoid hiding or removing the component itself with display: none, hidden, aria-hidden, or conditional rendering. Prefer updating or conditionally rendering its children instead. Renders a <div> element.

Base UI Combobox.Empty docs

ComboboxGroup

Groups related items with the corresponding label. Renders a <div> element.

Base UI Combobox.Group docs

Props
PropTypeDefaultDetails
itemsreadonly Item[]No default
Base UI Combobox.Group docs

ComboboxGroupLabel

An accessible label that is automatically associated with its parent group. Renders a <div> element.

Base UI Combobox.GroupLabel docs

ComboboxIcon

An icon that indicates that the trigger button opens the popup. Renders a <span> element.

Base UI Combobox.Icon docs

ComboboxInput

A text input to search for items in the list. Renders an <input> element.

Base UI Combobox.Input docs

Props
PropTypeDefaultDetails
size'large' | 'medium' | 'small''medium'
Base UI Combobox.Input docs
Data attributes
AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-pressed

Present when the input is pressed.

data-disabled

Present when the component is disabled.

data-readonly

Present when the component is readonly.

data-popup-side

Values: 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start' | null

Indicates which side the corresponding popup is positioned relative to its anchor.

data-required

Present when the component is required.

data-valid

Present when the component is in a valid state (when wrapped in Field.Root).

data-invalid

Present when the component is in an invalid state (when wrapped in Field.Root).

data-touched

Present when the component has been touched (when wrapped in Field.Root).

data-dirty

Present when the component's value has changed (when wrapped in Field.Root).

data-filled

Present when the component has a value (when wrapped in Field.Root).

data-focused

Present when the input is focused (when wrapped in Field.Root).

data-list-empty

Present when the corresponding items list is empty.

ComboboxInputGroup

A wrapper for the input and its associated controls. Renders a <div> element.

Base UI Combobox.InputGroup docs

Props
PropTypeDefaultDetails
size'large' | 'medium' | 'small''medium'
Base UI Combobox.InputGroup docs
Data attributes
AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-pressed

Present when the input group is pressed.

data-disabled

Present when the component is disabled.

data-readonly

Present when the component is readonly.

data-popup-side

Values: 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start' | null

Indicates which side the corresponding popup is positioned relative to its anchor.

data-valid

Present when the component is in a valid state (when wrapped in Field.Root).

data-invalid

Present when the component is in an invalid state (when wrapped in Field.Root).

data-touched

Present when the component has been touched (when wrapped in Field.Root).

data-dirty

Present when the component's value has changed (when wrapped in Field.Root).

data-filled

Present when the component has a value (when wrapped in Field.Root).

data-focused

Present when the component is focused (when wrapped in Field.Root).

data-list-empty

Present when the corresponding items list is empty.

data-placeholder

Present when the combobox doesn't have a value.

ComboboxInputTrigger

A button that opens the popup. Renders a <button> element.

Base UI Combobox.Trigger docs

Props
PropTypeDefaultDetails
size'large' | 'medium' | 'small''medium'
Base UI Combobox.Trigger docs
Data attributes
AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-pressed

Present when the trigger is pressed.

data-disabled

Present when the component is disabled.

data-readonly

Present when the component is readonly.

data-popup-side

Values: 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start' | null

Indicates which side the corresponding popup is positioned relative to its anchor.

data-required

Present when the component is required.

data-valid

Present when the component is in a valid state (when wrapped in Field.Root).

data-invalid

Present when the component is in an invalid state (when wrapped in Field.Root).

data-touched

Present when the component has been touched (when wrapped in Field.Root).

data-dirty

Present when the component's value has changed (when wrapped in Field.Root).

data-filled

Present when the component has a value (when wrapped in Field.Root).

data-focused

Present when the trigger is focused (when wrapped in Field.Root).

data-list-empty

Present when the corresponding items list is empty.

data-placeholder

Present when the combobox doesn't have a value.

ComboboxItem

An individual item in the list. Renders a <div> element.

Base UI Combobox.Item docs

Props
PropTypeDefaultDetails
valueValueNo default
Base UI Combobox.Item docs
Data attributes
AttributeDescription
data-selected

Present when the item is selected.

data-highlighted

Present when the item is highlighted.

data-disabled

Present when the item is disabled.

ComboboxItemIndicator

Indicates whether the item is selected. Renders a <span> element.

Base UI Combobox.ItemIndicator docs

Props
PropTypeDefaultDetails
childrenReact.ReactNodeNo default
Base UI Combobox.ItemIndicator docs
Data attributes
AttributeDescription
data-starting-style

Present when the indicator begins animating in.

data-ending-style

Present when the indicator is animating out.

ComboboxItemText

Accepts the props of the element it renders.

ComboboxLabel

An accessible label that is automatically associated with the combobox trigger. Renders a <div> element.

Base UI Combobox.Label docs

Data attributes
AttributeDescription
data-disabled

Present when the component should ignore user interaction.

data-touched

Present when the field has been touched.

data-dirty

Present when the field value has changed from its initial value.

data-filled

Present when the field has a value.

data-focused

Present when the field is focused.

ComboboxList

A list container for the items. Renders a <div> element.

Base UI Combobox.List docs

Props
PropTypeDefaultDetails
children((item: Item, index: number) => React.ReactNode) | React.ReactNodeNo default
Base UI Combobox.List docs
Data attributes
AttributeDescription
data-empty

Whether the list is empty.

ComboboxPopup

A container for the list. Renders a <div> element.

Base UI Combobox.Popup docs

Data attributes
AttributeDescription
data-open

Present when the popup is open.

data-closed

Present when the popup is closed.

data-starting-style

Present when the popup begins animating in.

data-ending-style

Present when the popup is animating out.

data-side

Values: 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'

Indicates which side the popup is positioned relative to the trigger.

data-align

Values: 'start' | 'center' | 'end'

Indicates how the popup is aligned relative to specified side.

data-anchor-hidden

Present when the anchor is hidden.

data-empty

Present when the items list is empty.

ComboboxPortal

A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to <body>. Renders a <div> element.

Base UI Combobox.Portal docs

ComboboxPositioner

Positions the popup against the trigger. Renders a <div> element.

Base UI Combobox.Positioner docs

Props
PropTypeDefaultDetails
align'center' | 'end' | 'start''start'
sideOffsetnumber | OffsetFunction4
Base UI Combobox.Positioner docs
Data attributes
AttributeDescription
data-open

Present when the popup is open.

data-closed

Present when the popup is closed.

data-anchor-hidden

Present when the anchor is hidden.

data-side

Values: 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'

Indicates which side the popup is positioned relative to the trigger.

data-align

Values: 'start' | 'center' | 'end'

Indicates how the popup is aligned relative to specified side.

data-empty

Present when the items list is empty.

CSS variables
VariableDescription
--available-width

Values: number

The available width between the trigger and the edge of the viewport.

--available-height

Values: number

The available height between the trigger and the edge of the viewport.

--anchor-width

Values: number

The anchor's width.

--anchor-height

Values: number

The anchor's height.

--transform-origin

Values: string

The coordinates that this element is anchored to. Used for animations and transitions.

ComboboxRow

Displays a single row of items in a grid list. Enable grid on the root component to turn the listbox into a grid. Renders a <div> element.

Base UI Combobox.Row docs

ComboboxSeparator

A visual separator between items or groups. Renders a <div> element.

Base UI Combobox.Separator docs

Data attributes
AttributeDescription
data-orientation

Values: 'horizontal' | 'vertical'

The orientation of the separator.

ComboboxStatus

Displays a status message whose content changes are announced politely to screen readers. Useful for conveying the status of an asynchronously loaded list. This component's root element must remain mounted in the DOM to announce changes consistently across screen readers. Avoid hiding or removing the component itself with display: none, hidden, aria-hidden, or conditional rendering. Prefer updating or conditionally rendering its children instead. Renders a <div> element.

Base UI Combobox.Status docs

ComboboxTrigger

Opens the combobox popup; carries only focus-ring styles so callers own its appearance directly or via render. Renders a <button> element.

Base UI Combobox.Trigger docs

Data attributes
AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-pressed

Present when the trigger is pressed.

data-disabled

Present when the component is disabled.

data-readonly

Present when the component is readonly.

data-popup-side

Values: 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start' | null

Indicates which side the corresponding popup is positioned relative to its anchor.

data-required

Present when the component is required.

data-valid

Present when the component is in a valid state (when wrapped in Field.Root).

data-invalid

Present when the component is in an invalid state (when wrapped in Field.Root).

data-touched

Present when the component has been touched (when wrapped in Field.Root).

data-dirty

Present when the component's value has changed (when wrapped in Field.Root).

data-filled

Present when the component has a value (when wrapped in Field.Root).

data-focused

Present when the trigger is focused (when wrapped in Field.Root).

data-list-empty

Present when the corresponding items list is empty.

data-placeholder

Present when the combobox doesn't have a value.

ComboboxValue

The current value of the combobox. Doesn't render its own HTML element.

Base UI Combobox.Value docs

Props
PropTypeDefaultDetails
children((selectedValue: ComboboxSelectedValue<Value, Multiple>) => React.ReactNode) | React.ReactNodeNo default
Base UI Combobox.Value docs

createComboboxItems

Creates a collection for the root's items prop. Values and labels are derived on first use.

Accepts either a flat item array or an array of groups. The getValue and getLabel accessors receive items, not groups.

Items cannot have an items array property because they would be interpreted as groups. Rename that field or cast the data when the runtime values are known not to contain arrays.

The data must not contain nullish entries: remove them before creating the collection, as for the root's items prop.

Create static collections at module scope. Wrap dynamic collections in React.useMemo() keyed by their data.

Parameters
ParameterTypeDescription
data required(ComboboxItemsData<Item> & RejectGroupShapedItems<Item>) | undefined

The flat or grouped source items, or undefined while they are loading.

options requiredCreateComboboxItemsOptions<Item, Value>

Functions that derive each source item's selection value and display label.

Returns

ComboboxItemCollection<Item, Value>

A collection whose selection value is the getValue accessor's return value.

useComboboxFilter

Matches items against a query using Intl.Collator for robust string matching.

Parameters
ParameterTypeDescription
optionsUseComboboxFilterOptionsNo description

Returns

Filter
Return properties
MemberTypeDescription
contains required<Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean

Returns whether the item matches the query anywhere.

startsWith required<Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean

Returns whether the item starts with the query.

endsWith required<Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean

Returns whether the item ends with the query.

useComboboxFilteredItems

Returns the internally filtered items. Treat the result as read-only: it is internal state and may be a shared frozen array.

Returns

T[]