Appica UIUI 1.0.0

Autocomplete

A text input that suggests matching options as you type.

Usage

Autocomplete is a compound component. The root holds the data (items) and shared options (size, variant, clearable, icon); the parts compose the input and the filtered popup:

  • AutocompleteInput — the text field, styled like Input. Add a clear button with clearable and a dropdown chevron with icon (both on the root, both off by default).
  • AutocompleteContent — the portalled, auto-positioned popup. Accepts the shared floating props (side, align, sideOffset, …).
  • AutocompleteList — the scrollable list. Pass a render function to map over the filtered items, or static AutocompleteItems.
  • AutocompleteItem — one option; its value is what selection reports.
  • AutocompleteEmpty — shown only when the filter matches nothing.

Examples

Variants

variant switches the input appearance between a bordered outline (default) and a filled soft field.

Sizes

size on the root scales the input, popup radius, and items together.

Clearable & chevron

Set clearable to add a clear (✕) button once there's a value, and icon to add a chevron that toggles the popup. Both render inside the input and are off by default.

Items with icons

Items can render any content. Mark a leading icon with data-icon="start" so it gets the same inner spacing as in Button. When items are objects rather than strings, give the root an itemToStringValue so the filter and input know how to read each one. Here the selected command's icon is mirrored back into the input via AutocompleteInput's startSlot.

The same object-item pattern with country flags — a typical country picker. Each item renders a flag before the name, and the selected country's flag is mirrored into the input through startSlot.

Grouped options

Pass a grouped items array — { value, items }[] — and render each group with AutocompleteGroup + AutocompleteLabel + AutocompleteCollection. The outer render function iterates groups; AutocompleteCollection renders the items inside each.

Grid layout

Set grid on the root to lay options out in a grid (arrow keys move in two dimensions). AutocompleteList's cols controls how many items per row.

Controlled

Drive the input value yourself with value + onValueChange — useful for syncing with form state or reacting to every keystroke.

RTL

Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior — roving focus, popup placement, and the like — follows the same direction.

For setup details and caveats, see the RTL guide.

API reference

Autocomplete wraps Base UI's Autocomplete. Each part forwards every remaining prop to the matching Base UI primitive, so anything it accepts works here — the tables below list the Appica additions and the most common props. See the Base UI docs for the complete API.

Autocomplete

The root. Holds the data and the shared styling/behavior options; renders no DOM of its own.

AutocompleteInput

The text field. Renders Base UI's Input inside an InputGroup, styled like Input.

Also forwards every native <input> prop (onChange, name, aria-*, ref, …).

AutocompleteContent

The portalled, auto-positioned popup wrapping the list. Accepts the shared floating props.

AutocompleteList

The scrollable list container.

AutocompleteItem

One option in the list.

AutocompleteEmpty

Shown only when the filter matches nothing — otherwise it renders nothing.

AutocompleteStatus

A persistent row that stays mounted (e.g. a loading or count message), unlike AutocompleteEmpty.

AutocompleteGroup

Wraps one labelled section of a grouped list.

AutocompleteLabel

The visible label for an AutocompleteGroup.

AutocompleteCollection

Renders the items inside an AutocompleteGroup.

AutocompleteSeparator

A thin divider between sections.

AutocompleteTrigger

A standalone button that opens the popup (e.g. a tag picker that isn't a text field).

Also forwards every native <button> prop (onClick, aria-*, ref, …).

AutocompleteValue

Renders the current value for read-only display.

Accessibility

  • The input has role="combobox"; the popup is a listbox (or grid when grid is set) and items are option/gridcell. Selection and active state are wired through aria-activedescendant.
  • ↑/↓ move the highlight, Enter selects, Escape closes the popup, and typing filters the list.
  • The clear and chevron buttons have aria-labels (Clear selection, Toggle popup) and become disabled when the input is disabled.
  • Always give AutocompleteInput a visible label or an aria-label.
  • Popup enter/exit transitions are wrapped so they're skipped when the user prefers reduced motion.

© 2026 Appica UI. A free component library, crafted by the Appica team.