Autocomplete
A text input that suggests values as the user types.
Tags group apps on the Studio page.
Usage guidelines
- Use
Autocompletefor free-form text with optional suggestions; the value is the typed text. UseComboboxto select and remember one or more values from a searchable collection, andSelectto choose from a closed, scannable list without text entry. - Give the input an accessible name with
FieldLabelinside aField, oraria-labelwhen the layout already labels it visually. - Pass
itemsto the root so filtering and the list share one source. For groups, pass an array of{ label, items }objects and render them withuseAutocompleteFilteredItems,AutocompleteGroupandAutocompleteCollection. - Use
AutocompleteClearin the input group to clear the typed text.AutocompleteTriggeris optional and opens the suggestions without typing. - Keep
AutocompleteEmptywhen the empty state needs explanation, for example that the typed text is kept as entered. When omittingAutocompleteEmpty, adddata-empty:hiddentoAutocompletePositionerso an empty popup frame does not stay visible when nothing matches. - The popup follows the input group width and clamps to the viewport with Base UI's
--anchor-widthand--available-width. Do not replace that sizing with a fixed width.
Anatomy
Examples
Grouped suggestions
Group suggestions under an AutocompleteGroupLabel. The filter keeps the group shape, so a group with no matches disappears.
Choose a standard header or type a custom header for the HTTP Request node.
Inline completion
With mode="both", the input previews the highlighted suggestion while the list filters. Omitting AutocompleteEmpty and setting data-empty:hidden on AutocompletePositioner hides the popup cleanly when no saved instruction matches, while keeping any text the user enters.
Type a prefix to preview an inline completion, or keep any custom instruction.
Keyboard
| Key | Action |
|---|---|
| Down arroworUp arrow | Opens the suggestions and moves the highlight. With mode="both", the input previews the highlighted one. |
| Enter | Fills the input with the highlighted suggestion and closes the suggestions. |
| Escape | Closes the suggestions and keeps the typed text. With the suggestions closed, clears the input. |
API reference
Autocomplete
Groups all parts of an autocomplete for free-form text inputs with suggestions. Doesn't render its own HTML element.
| Prop | Type | Default | Details |
|---|---|---|---|
form | string | No default | |
items | readonly ItemValue[] | readonly Group<ItemValue>[] | No default | |
filteredItems | readonly ItemValue[] | readonly Group<ItemValue>[] | No default | |
filter | ((item: ItemValue, query: string, itemToString?: ((item: ItemValue) => string) | undefined) => boolean) | null | No default | |
mode | 'both' | 'inline' | 'list' | 'none' | 'list' | |
inline | boolean | false | |
autoHighlight | 'always' | boolean | false | |
keepHighlight | boolean | false | |
highlightItemOnHover | boolean | true | |
defaultValue | string | number | readonly string[] | No default | |
value | string | number | readonly string[] | No default | |
onValueChange | ((value: string, eventDetails: AutocompleteRootChangeEventDetails) => void) | No default | |
submitOnItemClick | boolean | false | |
itemToStringValue | ((itemValue: ItemValue) => string) | No default | |
actionsRef | React.RefObject<AutocompleteRootActions | null> | No default | |
onOpenChange | ((open: boolean, eventDetails: AutocompleteRootOpenChangeEventDetails) => void) | No default | |
onItemHighlighted | ((highlightedValue: ItemValue | undefined, eventDetails: AutocompleteRootHighlightEventDetails) => void) | No default | |
openOnInputClick | boolean | false | |
children | React.ReactNode | No default | |
name | string | No default | |
id | string | No default | |
required | boolean | false | |
readOnly | boolean | false | |
disabled | boolean | false | |
defaultOpen | boolean | false | |
open | boolean | No default | |
onOpenChangeComplete | ((open: boolean) => void) | No default | |
loopFocus | boolean | true | |
inputRef | React.Ref<HTMLInputElement> | No default | |
grid | boolean | false | |
virtualized | boolean | false | |
modal | boolean | false | |
limit | number | -1 | |
locale | Intl.LocalesArgument | No default | |
AutocompleteClear
Clears the value when clicked. Renders a <button> element.
| Prop | Type | Default | Details |
|---|---|---|---|
size | 'large' | 'medium' | 'small' | 'medium' | |
disabled | boolean | false | |
keepMounted | boolean | false | |
className | string | ((state: ComboboxClearState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxClearState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxClearState) => React.CSSProperties | undefined) | No default | |
nativeButton | boolean | true | |
| Attribute | Description |
|---|---|
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. |
AutocompleteCollection
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.
| Prop | Type | Default | Details |
|---|---|---|---|
children required | (item: Value, index: number) => React.ReactNode | No default | |
AutocompleteEmpty
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.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: ComboboxEmptyState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxEmptyState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxEmptyState) => React.CSSProperties | undefined) | No default | |
AutocompleteGroup
Groups related items with the corresponding label. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
items | readonly Value[] | No default | |
className | string | ((state: ComboboxGroupState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxGroupState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxGroupState) => React.CSSProperties | undefined) | No default | |
AutocompleteGroupLabel
An accessible label that is automatically associated with its parent group. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: ComboboxGroupLabelState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxGroupLabelState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxGroupLabelState) => React.CSSProperties | undefined) | No default | |
AutocompleteIcon
An icon that indicates that the trigger button opens the popup. Renders a <span> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: ComboboxIconState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxIconState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxIconState) => React.CSSProperties | undefined) | No default | |
AutocompleteInput
A text input to search for items in the list. Renders an <input> element.
| Prop | Type | Default | Details |
|---|---|---|---|
size | 'large' | 'medium' | 'small' | 'medium' | |
className | string | ((state: ComboboxInputState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxInputState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxInputState) => React.CSSProperties | undefined) | No default | |
disabled | boolean | false | |
| Attribute | Description |
|---|---|
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: 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. |
AutocompleteInputGroup
A wrapper for the input and its associated controls. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
size | 'large' | 'medium' | 'small' | 'medium' | |
className | string | ((state: AutocompleteInputGroupState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, AutocompleteInputGroupState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: AutocompleteInputGroupState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
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: 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. |
AutocompleteItem
An individual item in the list. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
value | Value | No default | |
className | string | ((state: AutocompleteItemState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, AutocompleteItemState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: AutocompleteItemState) => React.CSSProperties | undefined) | No default | |
nativeButton | boolean | false | |
children | React.ReactNode | No default | |
index | number | No default | |
disabled | boolean | false | |
| Attribute | Description |
|---|---|
data-highlighted | Present when the item is highlighted. |
data-disabled | Present when the item is disabled. |
AutocompleteItemIndicator
Accepts the props of the element it renders.
AutocompleteItemText
Accepts the props of the element it renders.
AutocompleteList
A list container for the items. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
children | ((item: Value, index: number) => React.ReactNode) | React.ReactNode | No default | |
className | string | ((state: ComboboxListState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxListState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxListState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-empty | Whether the list is empty. |
AutocompletePopup
A container for the list. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: ComboboxPopupState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxPopupState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxPopupState) => React.CSSProperties | undefined) | No default | |
initialFocus | boolean | React.RefObject<HTMLElement | null> | ((openType: InteractionType) => void | boolean | HTMLElement | null) | No default | |
finalFocus | boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => void | boolean | HTMLElement | null) | No default | |
| Attribute | Description |
|---|---|
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: Indicates which side the popup is positioned relative to the trigger. |
data-align | Values: 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. |
AutocompletePortal
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.
| Prop | Type | Default | Details |
|---|---|---|---|
keepMounted | boolean | false | |
container | HTMLElement | React.RefObject<HTMLElement | ShadowRoot | null> | ShadowRoot | null | No default | |
className | string | ((state: ComboboxPortalState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxPortalState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxPortalState) => React.CSSProperties | undefined) | No default | |
AutocompletePositioner
Positions the popup against the trigger. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
align | 'center' | 'end' | 'start' | 'start' | |
sideOffset | number | OffsetFunction | 4 | |
className | string | ((state: ComboboxPositionerState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxPositionerState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxPositionerState) => React.CSSProperties | undefined) | No default | |
anchor | Element | React.RefObject<Element | null> | VirtualElement | (() => Element | VirtualElement | null) | null | No default | |
positionMethod | 'absolute' | 'fixed' | 'absolute' | |
side | 'bottom' | 'inline-end' | 'inline-start' | 'left' | 'right' | 'top' | 'bottom' | |
alignOffset | number | OffsetFunction | 0 | |
collisionBoundary | Boundary | 'clipping-ancestors' | |
collisionPadding | Padding | 5 | |
sticky | boolean | false | |
arrowPadding | number | 5 | |
disableAnchorTracking | boolean | false | |
collisionAvoidance | CollisionAvoidance | No default | |
| Attribute | Description |
|---|---|
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: Indicates which side the popup is positioned relative to the trigger. |
data-align | Values: Indicates how the popup is aligned relative to specified side. |
data-empty | Present when the items list is empty. |
| Variable | Description |
|---|---|
--available-width | Values: The available width between the trigger and the edge of the viewport. |
--available-height | Values: The available height between the trigger and the edge of the viewport. |
--anchor-width | Values: The anchor's width. |
--anchor-height | Values: The anchor's height. |
--transform-origin | Values: The coordinates that this element is anchored to. Used for animations and transitions. |
AutocompleteRow
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.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: ComboboxRowState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxRowState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxRowState) => React.CSSProperties | undefined) | No default | |
AutocompleteSeparator
A visual separator between items or groups. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
orientation | 'horizontal' | 'vertical' | 'horizontal' | |
className | string | ((state: AutocompleteSeparatorState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, AutocompleteSeparatorState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: AutocompleteSeparatorState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-orientation | Values: The orientation of the separator. |
AutocompleteStatus
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.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: ComboboxStatusState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, ComboboxStatusState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: ComboboxStatusState) => React.CSSProperties | undefined) | No default | |
AutocompleteTrigger
A button that opens the popup. Renders a <button> element.
| Prop | Type | Default | Details |
|---|---|---|---|
size | 'large' | 'medium' | 'small' | 'medium' | |
disabled | boolean | false | |
className | string | ((state: AutocompleteTriggerState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, AutocompleteTriggerState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: AutocompleteTriggerState) => React.CSSProperties | undefined) | No default | |
nativeButton | boolean | true | |
| Attribute | Description |
|---|---|
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: 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. |
AutocompleteValue
The current value of the autocomplete. Doesn't render its own HTML element.
| Prop | Type | Default | Details |
|---|---|---|---|
children | ((value: string) => React.ReactNode) | React.ReactNode | No default | |
useAutocompleteFilter
| Parameter | Type | Description |
|---|---|---|
options | GetFilterParameters | No description |
Returns
Filter| Member | Type | Description |
|---|---|---|
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. |
useAutocompleteFilteredItems
Returns
readonly Value[]