Skip to contents

Autocomplete

An input that suggests options as you type.

View as Markdown

Usage guidelines

  • Avoid when selection state is needed: Use Combobox instead of Autocomplete if the selection should be remembered and the input value cannot be custom. Unlike Combobox, Autocomplete’s input can contain free-form text, as its suggestions only optionally autocomplete the text.
  • Can be used for filterable command pickers: The input can be used as a filter for command items that perform an action when clicked when rendered inside the popup.
  • Form controls must have an accessible name: It can be created using a <label> element or the Field component. See the forms guide.

Anatomy

Import the components and place them together:

Anatomy

TypeScript inference

Autocomplete infers the item type from the items prop passed to <Autocomplete.Root>. If using itemToStringValue, the value prop on the <Autocomplete.Item> must match the type of an item in the items array.

Examples

Load items asynchronously while typing and render custom status content.

Inline autocomplete

Autofill the input with the highlighted item while navigating with arrow keys using the mode prop. Accepts aria-autocomplete values list, both, inline, or none.

Grouped

Organize related options with <Autocomplete.Group> and <Autocomplete.GroupLabel> to add section headings inside the popup.

Groups are represented by an array of objects with an items property, which itself is an array of individual items for each group. An extra property, such as value, can be provided for the heading text when rendering the group label.

Example

Fuzzy matching

Use fuzzy matching to find relevant results even when the query doesn’t exactly match the item text.

Limit results

Limit the number of visible items using the limit prop and guide users to refine their query using <Autocomplete.Status>.

Auto highlight

The first matching item can be automatically highlighted as the user types by specifying the autoHighlight prop on <Autocomplete.Root>. Set the prop’s value to "always" if the highlight should always be present, such as when the list is rendered inline within a dialog.

The prop can be combined with the keepHighlight and highlightItemOnHover props to configure how the highlight behaves during mouse interactions.

Command palette

Use the autocomplete input to filter a list of command items that perform an action when clicked.

Grid layout

Display items in a grid layout, wrapping each row in <Autocomplete.Row> components.

Virtualized

Efficiently handle large datasets using a virtualization library like @tanstack/react-virtual.

API reference

Root

Groups all parts of the autocomplete. Doesn’t render its own HTML element.

namestring
Name
Description

Identifies the field when a form is submitted.

Type
defaultValueUnion
Description

The uncontrolled input value of the autocomplete when it’s initially rendered.

To render a controlled autocomplete, use the value prop instead.

Type
valueUnion
Name
Description

The input value of the autocomplete. Use when controlled.

Type
onValueChangefunction
Description

Event handler called when the input value of the autocomplete changes.

Type
defaultOpenbooleanfalse
Description

Whether the popup is initially open.

To render a controlled popup, use the open prop instead.

Type
Default
false
openboolean
Name
Description

Whether the popup is currently open. Use when controlled.

Type
onOpenChangefunction
Description

Event handler called when the popup is opened or closed.

Type
autoHighlightboolean | 'always'false
Description

Whether the first matching item is highlighted automatically.

  • true: highlight after the user types and keep the highlight while the query changes.
  • 'always': always highlight the first item.
Type
Default
false
keepHighlightbooleanfalse
Description

Whether the highlighted item should be preserved when the pointer leaves the list.

Type
Default
false
highlightItemOnHoverbooleantrue
Description

Whether moving the pointer over items should highlight them. Disabling this prop allows CSS :hover to be differentiated from the :focus (data-highlighted) state.

Type
Default
true
actionsRefReact.RefObject<Autocomplete.Root.Actions | null>
Description

A ref to imperative actions.

  • unmount: When specified, the autocomplete will not be unmounted when closed. Instead, the unmount function must be called to unmount the autocomplete manually. Useful when the autocomplete’s animation is controlled by an external library.
Type
filterfunction
Name
Description

AutocompleteFilter function used to match items vs input query.

Type
filteredItemsany[] | Group[]
Description

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.

Type
formstring
Name
Description

Identifies the form that owns the internal input. Useful when the combobox is rendered outside the form.

Type
gridbooleanfalse
Name
Description

Whether list items are presented in a grid layout. When enabled, arrow keys navigate across rows and columns inferred from DOM rows.

Type
Default
false
inlinebooleanfalse
Name
Description

Whether the list is rendered inline without using the popup.

Type
Default
false
itemToStringValuefunction
Description

When the item values are objects (<Autocomplete.Item value={object}>), this function converts the object value to a string representation for both display in the input and form submission. If the shape of the object is { value, label }, the label will be used automatically without needing to specify this prop.

Type
itemsUnion
Name
Description

The items to be displayed in the list. Can be either a flat array of items or an array of groups with items.

Type
limitnumber-1
Name
Description

The maximum number of items to display in the list.

Type
Default
-1
localeIntl.LocalesArgument
Name
Description

The locale to use for string comparison. Defaults to the user’s runtime locale.

Type
loopFocusbooleantrue
Description

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 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.

Type
Default
true
modalbooleanfalse
Name
Description

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.
Type
Default
false
modeUnion'list'
Name
Description

Controls how the autocomplete behaves with respect to list filtering and inline autocompletion.

  • list (default): items are dynamically filtered based on the input value. The input value does not change based on the active item.
  • both: items are dynamically filtered based on the input value, which will temporarily change based on the active item (inline autocompletion).
  • inline: items are static (not filtered), and the input value will temporarily change based on the active item (inline autocompletion).
  • none: items are static (not filtered), and the input value will not change based on the active item.
Type
Default
'list'
onItemHighlightedfunction
Description

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.
Type
onOpenChangeCompletefunction
Description

Event handler called after any animations complete when the popup is opened or closed.

Type
openOnInputClickbooleanfalse
Description

Whether the popup opens when clicking the input.

Type
Default
false
submitOnItemClickbooleanfalse
Description

Whether clicking an item should submit the autocomplete’s owning form. By default, clicking an item via a pointer or Enter key does not submit the owning form. Useful when the autocomplete is used as a single-field form search input.

Type
Default
false
virtualizedbooleanfalse
Description

Whether the items are being externally virtualized.

Type
Default
false
disabledbooleanfalse
Description

Whether the component should ignore user interaction.

Type
Default
false
readOnlybooleanfalse
Description

Whether the user should be unable to choose a different option from the popup.

Type
Default
false
requiredbooleanfalse
Description

Whether the user must choose a value before submitting a form.

Type
Default
false
inputRefReact.Ref<HTMLInputElement>
Description

A ref to the hidden input element.

Type
idstring
Name
Description

The id of the component.

Type
childrenReact.ReactNode
Type

Autocomplete.Root.PropsHide

Re-Export of Root props as AutocompleteRootProps

Autocomplete.Root.StateHide

Autocomplete.Root.ActionsHide

Autocomplete.Root.ChangeEventReasonHide

Autocomplete.Root.ChangeEventDetailsHide

Autocomplete.Root.HighlightEventReasonHide

Autocomplete.Root.HighlightEventDetailsHide

Value

The current value of the autocomplete. Doesn’t render its own HTML element.

children| React.ReactNode
| ((value: string) => React.ReactNode)
Type

Autocomplete.Value.PropsHide

Re-Export of Value props as AutocompleteValueProps

Autocomplete.Value.StateHide

Input

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

disabledbooleanfalse
Description

Whether the component should ignore user interaction.

Type
Default
false
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
data-popup-open

Present when the corresponding popup is open.

data-popup-side

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

data-list-empty

Present when the corresponding items list is empty.

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-required

Present when the component is required.

data-valid

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

data-invalid

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

data-dirty

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

data-touched

Present when the component has been touched (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).

AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-popup-side

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

data-list-empty

Present when the corresponding items list is empty.

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-required

Present when the component is required.

data-valid

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

data-invalid

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

data-dirty

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

data-touched

Present when the component has been touched (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).

Autocomplete.Input.PropsHide

Re-Export of Input props as AutocompleteInputProps

Autocomplete.Input.StateHide

InputGroup

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

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
data-popup-open

Present when the corresponding popup is open.

data-popup-side

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

data-list-empty

Present when the corresponding items list is empty.

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-valid

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

data-invalid

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

data-dirty

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

data-touched

Present when the component has been touched (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-placeholder

Present when the combobox doesn’t have a value.

AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-popup-side

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

data-list-empty

Present when the corresponding items list is empty.

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-valid

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

data-invalid

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

data-dirty

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

data-touched

Present when the component has been touched (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-placeholder

Present when the combobox doesn’t have a value.

Autocomplete.InputGroup.PropsHide

Re-Export of InputGroup props as AutocompleteInputGroupProps

Autocomplete.InputGroup.StateHide

Trigger

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

nativeButtonbooleantrue
Description

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>).

Type
Default
true
disabledbooleanfalse
Description

Whether the component should ignore user interaction.

Type
Default
false
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
data-popup-open

Present when the corresponding popup is open.

data-popup-side

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

data-list-empty

Present when the corresponding items list is empty.

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-required

Present when the component is required.

data-valid

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

data-invalid

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

data-dirty

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

data-touched

Present when the component has been touched (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-placeholder

Present when the combobox doesn’t have a value.

AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-popup-side

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

data-list-empty

Present when the corresponding items list is empty.

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-required

Present when the component is required.

data-valid

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

data-invalid

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

data-dirty

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

data-touched

Present when the component has been touched (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-placeholder

Present when the combobox doesn’t have a value.

Autocomplete.Trigger.PropsHide

Re-Export of Trigger props as AutocompleteTriggerProps

Autocomplete.Trigger.StateHide

Icon

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

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type

Autocomplete.Icon.PropsHide

Re-Export of Icon props as AutocompleteIconProps

Autocomplete.Icon.StateHide

Clear

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

nativeButtonbooleantrue
Description

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>).

Type
Default
true
disabledbooleanfalse
Description

Whether the component should ignore user interaction.

Type
Default
false
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
keepMountedbooleanfalse
Description

Whether the component should remain mounted in the DOM when not visible.

Type
Default
false
renderReactElement | function
Name
Description

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.

Type

Autocomplete.Clear.PropsHide

Re-Export of Clear props as AutocompleteClearProps

Autocomplete.Clear.StateHide

List

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

children| React.ReactNode
| ((item: any, index: number) => React.ReactNode)
Type
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type

Autocomplete.List.PropsHide

Re-Export of List props as AutocompleteListProps

Autocomplete.List.StateHide

Portal

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.

containerUnion
Description

A parent element to render the portal element into.

Type
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
keepMountedbooleanfalse
Description

Whether to keep the portal mounted in the DOM while the popup is hidden.

Type
Default
false
renderReactElement | function
Name
Description

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.

Type

Autocomplete.Portal.PropsHide

Re-Export of Portal props as AutocompletePortalProps

Autocomplete.Portal.StateHide

Backdrop

An overlay displayed beneath the popup. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
data-open

Present when the popup is open.

data-closed

Present when the popup is closed.

data-starting-style

Present when the popup is animating in.

data-ending-style

Present when the popup is animating out.

AttributeDescription
data-open

Present when the popup is open.

data-closed

Present when the popup is closed.

data-starting-style

Present when the popup is animating in.

data-ending-style

Present when the popup is animating out.

Autocomplete.Backdrop.PropsHide

Re-Export of Backdrop props as AutocompleteBackdropProps

Autocomplete.Backdrop.StateHide

Positioner

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

disableAnchorTrackingbooleanfalse
Description

Whether to disable the popup from tracking any layout shift of its positioning anchor.

Type
Default
false
alignAlign'center'
Name
Description

How to align the popup relative to the specified side.

Type
Default
'center'
alignOffsetnumber | OffsetFunction0
Description

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.
Type
Default
0
Example
sideSide'bottom'
Name
Description

Which side of the anchor element to align the popup against. May automatically change to avoid collisions.

Type
Default
'bottom'
sideOffsetnumber | OffsetFunction0
Description

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.
Type
Default
0
Example
arrowPaddingnumber5
Description

Minimum distance to maintain between the arrow and the edges of the popup.

Use it to prevent the arrow element from hanging out of the rounded corners of a popup.

Type
Default
5
anchorUnion
Name
Description

An element to position the popup against. By default, the popup will be positioned against the trigger.

Type
collisionAvoidanceCollisionAvoidance
Description

Determines how to handle collisions when positioning the popup.

side controls overflow on the preferred placement axis (top/bottom or left/right):

  • 'flip': keep the requested side when it fits; otherwise try the opposite side (top and bottom, or left and right).
  • 'shift': never change side; keep the requested side and move the popup within the clipping boundary so it stays visible.
  • 'none': do not correct side-axis overflow.

align controls overflow on the alignment axis (start/center/end):

  • 'flip': keep side, but swap start and end when the requested alignment overflows.
  • 'shift': keep side and requested alignment, then nudge the popup along the alignment axis to fit.
  • 'none': do not correct alignment-axis overflow.

fallbackAxisSide controls fallback behavior on the perpendicular axis when the preferred axis cannot fit:

  • 'start': allow perpendicular fallback and try the logical start side first (top before bottom, or left before right in LTR).
  • 'end': allow perpendicular fallback and try the logical end side first (bottom before top, or right before left in LTR).
  • 'none': do not fallback to the perpendicular axis.

When side is 'shift', explicitly setting align only supports 'shift' or 'none'. If align is omitted, it defaults to 'flip'.

Type
Example
collisionBoundaryBoundary'clipping-ancestors'
Description

An element or a rectangle that delimits the area that the popup is confined to.

Type
Default
'clipping-ancestors'
collisionPaddingPadding5
Description

Additional space to maintain from the edge of the collision boundary.

Type
Default
5
stickybooleanfalse
Name
Description

Whether to maintain the popup in the viewport after the anchor element was scrolled out of view.

Type
Default
false
positionMethod'absolute' | 'fixed''absolute'
Description

Determines which CSS position property to use.

Type
Default
'absolute'
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
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-align

Indicates how the popup is aligned relative to specified side.

data-empty

Present when the items list is empty.

data-side

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

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-align

Indicates how the popup is aligned relative to specified side.

data-empty

Present when the items list is empty.

data-side

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

--anchor-height

The anchor’s height.

--anchor-width

The anchor’s width.

--available-height

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

--available-width

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

--transform-origin

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

CSS VariableDescription
--anchor-height

The anchor’s height.

--anchor-width

The anchor’s width.

--available-height

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

--available-width

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

--transform-origin

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

Autocomplete.Positioner.PropsHide

Re-Export of Positioner props as AutocompletePositionerProps

Autocomplete.Positioner.StateHide

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

initialFocusUnion
Description

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.
Type
finalFocusUnion
Description

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.
Type
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
data-open

Present when the popup is open.

data-closed

Present when the popup is closed.

data-align

Indicates how the popup is aligned relative to specified side.

data-empty

Present when the items list is empty.

data-instant

Present if animations should be instant.

data-side

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

data-starting-style

Present when the popup is animating in.

data-ending-style

Present when the popup is animating out.

AttributeDescription
data-open

Present when the popup is open.

data-closed

Present when the popup is closed.

data-align

Indicates how the popup is aligned relative to specified side.

data-empty

Present when the items list is empty.

data-instant

Present if animations should be instant.

data-side

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

data-starting-style

Present when the popup is animating in.

data-ending-style

Present when the popup is animating out.

Autocomplete.Popup.PropsHide

Re-Export of Popup props as AutocompletePopupProps

Autocomplete.Popup.StateHide

Arrow

Displays an element positioned against the anchor. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
data-open

Present when the popup is open.

data-closed

Present when the popup is closed.

data-uncentered

Present when the arrow is uncentered.

data-align

Indicates how the popup is aligned relative to specified side.

data-side

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

AttributeDescription
data-open

Present when the popup is open.

data-closed

Present when the popup is closed.

data-uncentered

Present when the arrow is uncentered.

data-align

Indicates how the popup is aligned relative to specified side.

data-side

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

Autocomplete.Arrow.PropsHide

Re-Export of Arrow props as AutocompleteArrowProps

Autocomplete.Arrow.StateHide

Status

Displays a status message whose content changes are announced politely to screen readers. Useful for conveying the status of an asynchronously loaded list. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type

Autocomplete.Status.PropsHide

Re-Export of Status props as AutocompleteStatusProps

Autocomplete.Status.StateHide

Empty

Renders its children only when the list is empty. Requires the items prop on the root component. Announces changes politely to screen readers. Renders a <div> element.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type

Autocomplete.Empty.PropsHide

Re-Export of Empty props as AutocompleteEmptyProps

Autocomplete.Empty.StateHide

Collection

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.

children*
Type

Autocomplete.Collection.PropsHide

Re-Export of Collection props as AutocompleteCollectionProps

Autocomplete.Collection.StateHide

Row

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.

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type

Autocomplete.Row.PropsHide

Re-Export of Row props as AutocompleteRowProps

Autocomplete.Row.StateHide

Item

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

valueanynull
Name
Description

A unique value that identifies this item.

Type
Default
null
onClickfunction
Description

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.

Type
indexnumber
Name
Description

The index of the item in the list. Improves performance when specified by avoiding the need to calculate the index automatically from the DOM.

Type
nativeButtonbooleanfalse
Description

Whether 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.

Type
Default
false
disabledbooleanfalse
Description

Whether the component should ignore user interaction.

Type
Default
false
childrenReact.ReactNode
Type
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
data-selected

Present when the item is selected.

data-highlighted

Present when the item is highlighted.

data-disabled

Present when the item is disabled.

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.

Autocomplete.Item.PropsHide

Re-Export of Item props as AutocompleteItemProps

Autocomplete.Item.StateHide

Group

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

itemsany[]
Name
Description

Items to be rendered within this group. When provided, child Collection components will use these items.

Type
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type
data-popup-open

Present when the corresponding popup is open.

data-popup-side

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

data-list-empty

Present when the corresponding items list is empty.

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-valid

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

data-invalid

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

data-dirty

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

data-touched

Present when the component has been touched (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-placeholder

Present when the combobox doesn’t have a value.

AttributeDescription
data-popup-open

Present when the corresponding popup is open.

data-popup-side

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

data-list-empty

Present when the corresponding items list is empty.

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-valid

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

data-invalid

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

data-dirty

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

data-touched

Present when the component has been touched (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-placeholder

Present when the combobox doesn’t have a value.

Autocomplete.Group.PropsHide

Re-Export of Group props as AutocompleteGroupProps

Autocomplete.Group.StateHide

GroupLabel

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

classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type

Autocomplete.GroupLabel.PropsHide

Re-Export of GroupLabel props as AutocompleteGroupLabelProps

Autocomplete.GroupLabel.StateHide

Separator

A separator element accessible to screen readers. Renders a <div> element.

orientationOrientation'horizontal'
Description

The orientation of the separator.

Type
Default
'horizontal'
classNamestring | function
Description

CSS class applied to the element, or a function that returns a class based on the component’s state.

Type
styleReact.CSSProperties | function
Name
Type
renderReactElement | function
Name
Description

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.

Type

Autocomplete.Separator.PropsHide

Re-Export of Separator props as AutocompleteSeparatorProps

Autocomplete.Separator.StateHide

useFilter

Matches items against a query using Intl.Collator for robust string matching. This hook is used when externally filtering items.

Parameters

AutocompleteFilterOptions

localeIntl.LocalesArgument
Name
Description

The locale to use for string comparison. Defaults to the user’s runtime locale.

Type

Return value

AutocompleteFilter

containsfunction
Type
startsWithfunction
Type
endsWithfunction
Type

useFilteredItems

Returns the internally filtered items when called inside <Autocomplete.Root>.

Return value