Skip to main content
The Autocomplete component provides intelligent input completion with keyboard navigation, filtering, and accessibility support.

Import

Basic Usage

Sub-components

Autocomplete.Root

Groups all parts of the autocomplete. Doesn’t render its own HTML element. Key Props:
  • items: Array of items or groups. Can be flat array or array with { label, items } structure
  • value: Controlled input value
  • defaultValue: Uncontrolled default input value
  • onValueChange: Called when input value changes
  • mode: Behavior mode - 'list' | 'both' | 'inline' | 'none' (default: 'list')
    • list: Items filtered dynamically, input stays as typed
    • both: Items filtered + inline autocompletion
    • inline: Static items + inline autocompletion
    • none: Static items, no autocompletion
  • open: Controlled popup open state
  • defaultOpen: Uncontrolled default open state
  • onOpenChange: Called when popup opens/closes
  • filter: Custom filter function
  • autoHighlight: Whether to highlight first match (false | true | 'always')
  • keepHighlight: Whether to preserve highlight when pointer leaves (default: false)
  • highlightItemOnHover: Whether hovering highlights items (default: true)
  • disabled: Whether component is disabled (default: false)
  • name: Form field name
  • required: Whether field is required (default: false)
  • readOnly: Whether input is read-only (default: false)
  • itemToStringValue: Convert object items to string
  • onItemHighlighted: Called when item is highlighted/unhighlighted
  • submitOnItemClick: Whether selecting item submits form (default: false)
  • openOnInputClick: Whether clicking input opens popup (default: false)

Autocomplete.Trigger

Container for the input and clear button.

Autocomplete.Input

The text input element. Renders an <input> element.

Autocomplete.Clear

Button to clear the current input value.

Autocomplete.Portal

Portals the popup to a different part of the DOM (default: document.body).

Autocomplete.Positioner

Positions the popup relative to the trigger.

Autocomplete.Popup

The container for the list of items.

Autocomplete.List

Scrollable list container for items.

Autocomplete.Item

An individual item in the list. Renders a <div> by default. Props:
  • value: The value this item represents
  • disabled: Whether this item is disabled

Autocomplete.Empty

Displayed when no items match the filter.

Autocomplete.Group

Groups related items together.

Autocomplete.GroupLabel

Label for a group of items.

Autocomplete.Arrow

Arrow pointing to the trigger.

Autocomplete.Backdrop

Backdrop element shown when modal={true}.

Autocomplete.Value

Displays the current value (useful for custom rendering).

Autocompletion Modes

List Mode (Default)

Items filter as you type, input shows what you typed:

Inline Mode

Static items, input autocompletes to highlighted item:

Both Mode

Items filter AND input autocompletes:

None Mode

Static items, no autocompletion:

Grouped Items

Custom Filtering

Object Items

Styling

Form Integration