Combobox

A select you can type to filter, with optional multi-select chips.

<Combobox.Root items={specialties}>
	<Combobox.Input placeholder="Select a specialty" />
	<Combobox.Content>
		<Combobox.Empty>No specialty found.</Combobox.Empty>
		<Combobox.List>
			{(specialty: string) => (
				<Combobox.Item key={specialty} value={specialty}>{specialty}</Combobox.Item>
			)}
		</Combobox.List>
	</Combobox.Content>
</Combobox.Root>

Combobox.List takes a render function rather than elements, so the filtering stays inside the component instead of being something you reimplement.

Combobox.Chips, Combobox.Chip and Combobox.ChipsInput turn it into a multi-select whose picks appear as chips in the field.

API

Combobox.Root

PropTypeDefault
actionsRefRefObject<Actions | null>A ref to imperative actions.
autoCompletestringProvides a hint to the browser for autofill.
autoHighlightbooleanWhether the first matching item is highlighted automatically while filtering.
childrenReactNode
defaultInputValuestring | number | readonly string[]The uncontrolled input value when initially rendered. To render a controlled input, use the inputValue prop instead.
defaultOpenbooleanWhether the popup is initially open. To render a controlled popup, use the open prop instead.
defaultValueComboboxValueType<Value, Multiple> | nullThe uncontrolled selected value of the combobox when it's initially rendered. To render a controlled combobox, use the value prop instead.
disabledbooleanWhether the component should ignore user interaction.
filter((itemValue: Value, query: string, itemToString?: ((itemValue: Value) => string) | undefined) => boolean) | nullFilter function used to match items vs input query.
filteredItemsreadonly any[] | readonly Group<any>[]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.
formstringIdentifies the form that owns the internal input. Useful when the combobox is rendered outside the form.
gridbooleanWhether list items are presented in a grid layout. When enabled, arrow keys navigate across rows and columns inferred from DOM rows.
highlightItemOnHoverbooleanWhether moving the pointer over items should highlight them. Disabling this prop allows CSS :hover to be differentiated from the :focus (data-highlighted) state.
idstringThe id of the component.
inlinebooleanWhether 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>A ref to the hidden input element.
inputValuestring | number | readonly string[]The input value of the combobox. Use when controlled.
isItemEqualToValue((itemValue: Value, value: Value) => boolean)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>[]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)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)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.
limitnumberThe maximum number of items to display in the list.
localeLocalesArgumentThe locale to use for string comparison. Defaults to the user's runtime locale.
loopFocusbooleanWhether 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 ArrowDown again from the input, or the last item can be reached by pressing ArrowUp from the input. The input is always included in the focus loop per ARIA Authoring Practices. When disabled, focus does not move when on the last element and the user presses ArrowDown, or when on the first element and the user presses ArrowUp.
modalbooleanDetermines if the popup enters a modal state when open.
multipleMultipleWhether multiple items can be selected.
namestringIdentifies the field when a form is submitted.
onInputValueChange((inputValue: string, eventDetails: ChangeEventDetails) => void)Event handler called when the input value changes.
onItemHighlighted((highlightedValue: Value | undefined, eventDetails: HighlightEventDetails) => void)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:
onOpenChange((open: boolean, eventDetails: ChangeEventDetails) => void)Event handler called when the popup is opened or closed.
onOpenChangeComplete((open: boolean) => void)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)Event handler called when the selected value of the combobox changes.
openbooleanWhether the popup is currently open. Use when controlled.
openOnInputClickbooleanWhether the popup opens when clicking the input.
readOnlybooleanWhether the user should be unable to choose a different option from the popup.
requiredbooleanWhether the user must choose a value before submitting a form.
valueComboboxValueType<Value, Multiple> | nullThe selected value of the combobox. Use when controlled.
virtualizedbooleanWhether the items are being externally virtualized.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-root.tsx.

Combobox.Chip

PropTypeDefault
showRemovebooleantrue
classNamestring | ((state: ComboboxChipState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
renderComponentRenderFn<HTMLProps, ComboboxChipState> | ReactElement<unknown, string | JSXElementConstructor<any>>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: ComboboxChipState) => CSSProperties | undefined)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-chip.tsx.

Combobox.Chips

PropTypeDefault
classNamestring | ((state: ComboboxChipsState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
renderComponentRenderFn<HTMLProps, ComboboxChipsState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-chips.tsx.

Combobox.ChipsInput

PropTypeDefault
classNamestring | ((state: ComboboxInputState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
disabledbooleanWhether the component should ignore user interaction.
renderComponentRenderFn<HTMLProps, ComboboxInputState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-chips-input.tsx.

Combobox.Collection

PropTypeDefault
children(item: any, index: number) => ReactNoderequired

Plus the DOM props of the element it renders. Source: combobox/components/combobox-collection.tsx.

Combobox.Content

PropTypeDefault
alignAlign"start"How to align the popup relative to the specified side.
alignOffsetnumber | OffsetFunction0Additional 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:
anchorElement | RefObject<Element | null> | VirtualElement | (() => Element | VirtualElement | null) | nullAn element to position the popup against. By default, the popup will be positioned against the trigger.
classNamestring | ((state: ComboboxPopupState) => string | 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) => void | boolean | HTMLElement | null)Determines the element to focus when the popup is closed.
initialFocusboolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => void | boolean | HTMLElement | null)Determines the element to focus when the popup is opened.
renderComponentRenderFn<HTMLProps, ComboboxPopupState> | ReactElement<unknown, string | JSXElementConstructor<any>>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.
sideSide"bottom"Which side of the anchor element to align the popup against. May automatically change to avoid collisions.
sideOffsetnumber | OffsetFunction6Distance 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:
styleCSSProperties | ((state: ComboboxPopupState) => CSSProperties | undefined)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-content.tsx.

Combobox.Empty

PropTypeDefault
classNamestring | ((state: ComboboxEmptyState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
renderComponentRenderFn<HTMLProps, ComboboxEmptyState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-empty.tsx.

Combobox.Group

PropTypeDefault
classNamestring | ((state: ComboboxGroupState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
itemsreadonly any[]Items to be rendered within this group. When provided, child Collection components will use these items.
renderComponentRenderFn<HTMLProps, ComboboxGroupState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-group.tsx.

Combobox.Input

PropTypeDefault
showClearbooleanfalse
showTriggerbooleantrue
classNamestring | ((state: ComboboxInputState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
disabledbooleanfalseWhether the component should ignore user interaction.
renderComponentRenderFn<HTMLProps, ComboboxInputState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-input.tsx.

Combobox.Item

PropTypeDefault
childrenReactNode
classNamestring | ((state: ComboboxItemState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
disabledbooleanWhether the component should ignore user interaction.
indexnumberThe index of the item in the list. Improves performance when specified by avoiding the need to calculate the index automatically from the DOM.
nativeButtonbooleanWhether the component renders a native <button> element when replacing it via the render prop. Set to true if the rendered element is a native button.
onClick((event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void)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.
renderComponentRenderFn<HTMLProps, ComboboxItemState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.
valueanyA unique value that identifies this item.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-item.tsx.

Combobox.Label

PropTypeDefault
classNamestring | ((state: ComboboxGroupLabelState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
renderComponentRenderFn<HTMLProps, ComboboxGroupLabelState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-label.tsx.

Combobox.List

PropTypeDefault
children((item: any, index: number) => ReactNode) | ReactNode
classNamestring | ((state: ComboboxListState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
renderComponentRenderFn<HTMLProps, ComboboxListState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-list.tsx.

Combobox.Row

PropTypeDefault
classNamestring | ((state: ComboboxRowState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
renderComponentRenderFn<HTMLProps, ComboboxRowState> | ReactElement<unknown, string | JSXElementConstructor<any>>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: ComboboxRowState) => CSSProperties | undefined)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-row.tsx.

Combobox.Separator

PropTypeDefault
classNamestring | ((state: SeparatorState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
orientationOrientationThe orientation of the separator.
renderComponentRenderFn<HTMLProps, SeparatorState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-separator.tsx.

Combobox.Trigger

PropTypeDefault
classNamestring | ((state: ComboboxTriggerState) => string | undefined)CSS class applied to the element, or a function that returns a class based on the component's state.
disabledbooleanWhether the component should ignore user interaction.
nativeButtonbooleanWhether 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>).
renderComponentRenderFn<HTMLProps, ComboboxTriggerState> | ReactElement<unknown, string | JSXElementConstructor<any>>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)Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-trigger.tsx.

Combobox.Value

PropTypeDefault
children((selectedValue: any) => ReactNode) | ReactNode
placeholderReactNodeThe 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.

Plus the DOM props of the element it renders. Source: combobox/components/combobox-value.tsx.