Skip to content

Autocomplete

Free

A text field that suggests values while you type. The text you type stays the value, so it fits a search field or a command palette.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

The text is the value, so people can type what the list does not hold. Pass items for the suggestions.

The sample also uses Field. One command adds them with this item:

city-search.tsx

Autocomplete

PropTypeDefaultDescription
From Base UICombobox.RootBase UI docs
childrenReactNode—
namestring—Identifies the field when a form is submitted.
idstring—The id of the component.

AutocompleteInputGroup

<div>
PropTypeDefaultDescription
classNamestring—
size"default""lg""sm""xs""default"24, 28, 32, or 36px: the field sizes of controlVariants.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

AutocompleteTrigger

<button>
PropTypeDefaultDescription
classNamestring—
From Base UIAutocomplete.TriggerBase UI docs
disabledbooleanfalseWhether the component should ignore user interaction.
render—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.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<button> attributes—Every other attribute goes to the <button>, with a ref.

AutocompleteItem

<div>
PropTypeDefaultDescription
classNamestring—
From Base UIAutocomplete.ItemBase UI docs
childrenReactNode—
onClick—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.
indexnumber—The index of the item in the list. Improves performance when specified by avoiding the need to calculate the index automatically from the DOM.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it when the text itself is the value and a suggestion only fills it in.
  • Use filter={null} when a server gives the suggestions.
  • Use mode (list, both, inline, none) to set how the list and the text act.
  • Use onClick on an AutocompleteItem for a command. It runs on a press and on Enter.
  • When the value must be one item from a fixed list, use a Combobox.
  • For a short fixed list with no typing, use a Select.
  • For plain text with no suggestions, use an Input.
Down ArroworUp ArrowOpens the list, then moves the highlight.
EnterPicks the highlighted suggestion. With no highlight, closes the list.
EscapeCloses the list. With the list closed, clears the text.
HomeorEndMoves the caret to the start or the end of the text.

The input is a combobox, and the list is a listbox. The active row moves while focus stays in the input.

A Field with a FieldLabel names the input. The clear and trigger buttons stay out of the tab order.

On a coarse pointer, rows grow to 44px high. The text stays 14px.

Open
popup · 150ms · ease-panel (0.2, 0.4, 0.2, 1) · fades in and scales from 95%
Close
popup-exit · 120ms · ease-out (0, 0, 0.2, 1)

Built with

Installs with Autocomplete

  1. AddedAutocomplete, with Combobox, Separator.
Open the release