Skip to content

Combobox

Combobox combines a text input with a filterable listbox. Use when the list is long enough that free-text filtering improves efficiency. For short lists, use Select.

Code
<Combobox
items={[
{ value: "corn-seed", label: "Corn seed" },
{ value: "soybean-seed", label: "Soybean seed" },
{ value: "starter-fertilizer", label: "Starter fertilizer" },
{ value: "crop-protection", label: "Crop protection" },
{ value: "nitrogen", label: "Nitrogen" },
{ value: "potash", label: "Potash" },
]}
>
<ComboboxInput placeholder="Select product..." showClear />
<ComboboxContent>
<ComboboxEmpty>No products found.</ComboboxEmpty>
<ComboboxList>
{(product) => (
<ComboboxItem key={product.value} value={product}>
{product.label}
</ComboboxItem>
)}
</ComboboxList>
</ComboboxContent>
</Combobox>
NameType/Description
actionsRefRefObject<Actions | null> | undefined
A ref to imperative actions. - `unmount`: Manually unmounts the combobox. Call this after any externally controlled closing animation finishes.
autoCompletestring | undefined
Provides a hint to the browser for autofill. @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete
autoHighlight = falseboolean | undefined
Whether the first matching item is highlighted automatically while filtering.
defaultInputValuestring | number | readonly string[] | undefined
The uncontrolled input value when initially rendered. To render a controlled input, use the `inputValue` prop instead.
defaultOpen = falseboolean | undefined
Whether the popup is initially open. To render a controlled popup, use the `open` prop instead.
defaultValueComboboxValueType<Value, Multiple> | null | undefined
The uncontrolled selected value of the combobox when it's initially rendered. To render a controlled combobox, use the `value` prop instead.
disabled = falseboolean | undefined
Whether the component should ignore user interaction.
filter((itemValue: Value, query: string, itemToString?: ((itemValue: Value) => string) | undefined) => boolean) | null | undefined
Filter function used to match items vs input query.
filteredItemsreadonly any[] | readonly Group<any>[] | undefined
Filtered items to display in the list. When provided, the list will use these items instead of filtering the `items` prop internally. Use when you want to control filtering logic externally with the `useFilter()` hook.
formstring | undefined
Identifies the form that owns the internal input. Useful when the combobox is rendered outside the form.
grid = falseboolean | undefined
Whether list items are presented in a grid layout. When enabled, arrow keys navigate across rows and columns inferred from DOM rows.
highlightItemOnHover = trueboolean | undefined
Whether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state.
idstring | undefined
The id of the component.
inline = falseboolean | undefined
Whether the list is rendered inline without using the component's own popup. Specify `open` unconditionally in conjunction with this prop so the list is considered visible: `<Combobox.Root inline open>` In a `Combobox.Root` > `Dialog.Root` composition, bind the Combobox's `open` and `onOpenChange` props to the `Dialog`'s `open` and `onOpenChange` state instead so the component resets its transient state (filter query, highlighted item, and input value) when the dialog closes.
inputRefRef<HTMLInputElement> | undefined
A ref to the hidden input element.
inputValuestring | number | readonly string[] | undefined
The input value of the combobox. Use when controlled.
isItemEqualToValue((itemValue: Value, value: Value) => boolean) | undefined
Custom comparison logic used to determine if a combobox item value matches the current selected value. Useful when item values are objects without matching referentially. Defaults to `Object.is` comparison.
itemsreadonly any[] | readonly Group<any>[] | undefined
The items to be displayed in the list. Can be either a flat array of items or an array of groups with items.
itemToStringLabel((itemValue: Value) => string) | undefined
When the item values are objects (`<Combobox.Item value={object}>`), this function converts the object value to a string representation for display in the input. If the shape of the object is `{ value, label }`, the label will be used automatically without needing to specify this prop.
itemToStringValue((itemValue: Value) => string) | undefined
When the item values are objects (`<Combobox.Item value={object}>`), this function converts the object value to a string representation for form submission. If the shape of the object is `{ value, label }`, the value will be used automatically without needing to specify this prop.
limit = -1number | undefined
The maximum number of items to display in the list.
localeLocalesArgument
The locale to use for string comparison. Defaults to the user's runtime locale.
loopFocus = trueboolean | undefined
Whether to loop keyboard focus back to the input when the end of the list is reached while using the arrow keys. The first item can then be reached by pressing <kbd>ArrowDown</kbd> again from the input, or the last item can be reached by pressing <kbd>ArrowUp</kbd> from the input. The input is always included in the focus loop per [ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/). When disabled, focus does not move when on the last element and the user presses <kbd>ArrowDown</kbd>, or when on the first element and the user presses <kbd>ArrowUp</kbd>.
modal = falseboolean | undefined
Determines if the popup enters a modal state when open. - `true`: user interaction is limited to the popup: document page scroll is locked and pointer interactions on outside elements are disabled. - `false`: user interaction with the rest of the document is allowed.
multiple = falseboolean | undefined
Whether multiple items can be selected.
namestring | undefined
Identifies the field when a form is submitted.
onInputValueChange((inputValue: string, eventDetails: ChangeEventDetails) => void) | undefined
Event handler called when the input value changes.
onItemHighlighted((highlightedValue: Value | undefined, eventDetails: HighlightEventDetails) => void) | undefined
Callback fired when an item is highlighted or unhighlighted. Receives the highlighted item value (or `undefined` if no item is highlighted) and event details with a `reason` property describing why the highlight changed. The `reason` can be: - `'keyboard'`: the highlight changed due to keyboard navigation. - `'pointer'`: the highlight changed due to pointer hovering. - `'none'`: the highlight changed programmatically.
onOpenChange((open: boolean, eventDetails: ChangeEventDetails) => void) | undefined
Event handler called when the popup is opened or closed.
onOpenChangeComplete((open: boolean) => void) | undefined
Event handler called after any animations complete when the popup is opened or closed.
onValueChange((value: ComboboxValueType<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: ChangeEventDetails) => void) | undefined
Event handler called when the selected value of the combobox changes.
openboolean | undefined
Whether the popup is currently open. Use when controlled.
openOnInputClick = trueboolean | undefined
Whether the popup opens when clicking the input.
readOnly = falseboolean | undefined
Whether the user should be unable to choose a different option from the popup.
required = falseboolean | undefined
Whether the user must choose a value before submitting a form.
valueComboboxValueType<Value, Multiple> | null | undefined
The selected value of the combobox. Use when controlled.
virtualized = falseboolean | undefined
Whether the items are being externally virtualized.
NameType/Description
classNamestring | ((state: ComboboxChipState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxChipState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
showRemove = trueboolean | undefined
styleCSSProperties | ((state: ComboboxChipState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
classNamestring | ((state: ComboboxChipsState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxChipsState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: ComboboxChipsState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
classNamestring | ((state: ComboboxInputState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
disabled = falseboolean | undefined
Whether the component should ignore user interaction.
ref((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxInputState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: ComboboxInputState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.

No documented props

NameType/Description
align = "start"Align | undefined
How to align the popup relative to the specified side.
alignOffset = 0number | OffsetFunction | undefined
Additional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. @example ```jsx <Positioner alignOffset={({ side, align, anchor, positioner }) => { return side === 'top' || side === 'bottom' ? anchor.width : anchor.height; }} /> ```
anchorElement | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null) | null | undefined
An element to position the popup against. By default, the popup will be positioned against the trigger.
classNamestring | ((state: ComboboxPopupState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
finalFocusboolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null) | undefined
Determines the element to focus when the popup is closed. - `false`: Do not move focus. - `true`: Move focus based on the default behavior (trigger or previously focused element). - `RefObject`: Move focus to the ref element. - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`). Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing.
initialFocusboolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | void | HTMLElement | null) | undefined
Determines the element to focus when the popup is opened. - `false`: Do not move focus. - `true`: Move focus based on the default behavior (first tabbable element or popup). - `RefObject`: Move focus to the ref element. - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`). Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxPopupState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
side = "bottom"Side | undefined
Which side of the anchor element to align the popup against. May automatically change to avoid collisions.
sideOffset = 6number | OffsetFunction | undefined
Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. @example ```jsx <Positioner sideOffset={({ side, align, anchor, positioner }) => { return side === 'top' || side === 'bottom' ? anchor.height : anchor.width; }} /> ```
styleCSSProperties | ((state: ComboboxPopupState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
classNamestring | ((state: ComboboxEmptyState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxEmptyState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: ComboboxEmptyState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
classNamestring | ((state: ComboboxGroupState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
itemsreadonly any[] | undefined
Items to be rendered within this group. When provided, child `Collection` components will use these items.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxGroupState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: ComboboxGroupState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
classNamestring | ((state: ComboboxInputState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
disabled = falseboolean | undefined
Whether the component should ignore user interaction.
ref((instance: HTMLInputElement | null) => void) | RefObject<HTMLInputElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxInputState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
showClear = falseboolean | undefined
showTrigger = trueboolean | undefined
styleCSSProperties | ((state: ComboboxInputState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.

Pass the full item object as value, not just the string id — Base UI needs the full object to extract the label.

NameType/Description
classNamestring | ((state: ComboboxItemState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
disabled = falseboolean | undefined
Whether the component should ignore user interaction.
indexnumber | undefined
The index of the item in the list. Improves performance when specified by avoiding the need to calculate the index automatically from the DOM.
nativeButton = trueboolean | undefined
Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`).
onClick((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined
An optional click handler for the item when selected. It fires when clicking the item with the pointer, as well as when pressing `Enter` with the keyboard if the item is highlighted when the `Input` or `List` element has focus.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxItemState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: ComboboxItemState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
value = "null"any
A unique value that identifies this item.
NameType/Description
classNamestring | ((state: ComboboxGroupLabelState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxGroupLabelState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: ComboboxGroupLabelState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
classNamestring | ((state: ComboboxListState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxListState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: ComboboxListState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
classNamestring | ((state: SeparatorState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
orientation = "'horizontal'"Orientation | undefined
The orientation of the separator.
ref((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | undefined
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, SeparatorState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: SeparatorState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
classNamestring | ((state: ComboboxTriggerState) => string | undefined) | undefined
CSS class applied to the element, or a function that returns a class based on the component's state.
disabled = falseboolean | undefined
Whether the component should ignore user interaction.
nativeButton = trueboolean | undefined
Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`).
renderReactElement<any, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxTriggerState> | undefined
Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render.
styleCSSProperties | ((state: ComboboxTriggerState) => CSSProperties | undefined) | undefined
Style applied to the element, or a function that returns a style object based on the component's state.
NameType/Description
placeholderReactNode
The placeholder value to display when no value is selected. This is overridden by `children` if specified, or by a null item's label in `items`.