Autocomplete
A filterable text input that suggests matching values.
A filterable text input that suggests matching values.
Backed by Base UI Autocomplete for upstream behavior and configuration. Zenos owns the public API, styling, and composition shown on this page.
Import
Section titled “Import”import { Autocomplete } from "@zentara-co/zenos-ui";Autocomplete.InputGroup uses the shared sm, md, and lg control scale from Input.
Variants
Section titled “Variants”Choose a surface that matches the field hierarchy. default is the standard bordered control, filled is the subtle filled surface, and none is borderless for inline editing—the same variants as Input.
Custom styling
Section titled “Custom styling”Every Autocomplete part accepts className. Style Autocomplete.InputGroup for the field, then style Autocomplete.Content separately because the popup is rendered in a portal. Stable data-slot values and the data-highlighted state can restyle suggestions without replacing filtering or keyboard behavior. Pass positionerClassName on Content when the positioning wrapper needs classes of its own.
A branded treatment built from semantic color tokens.
Grouped suggestions
Section titled “Grouped suggestions”Pass an array of groups to items, with an items array on each group. Keep any label or other metadata alongside those items. Render the filtered groups through Autocomplete.List, then pass each group’s filtered items to Autocomplete.Group.
Use Autocomplete.GroupLabel to name the group and Autocomplete.Collection to render its suggestions. Collection does not add a wrapper element; it uses the items supplied by its group. Filtering matches the suggestions, hides groups with no matches, and keeps keyboard navigation on options rather than group headings.
Suggestions are grouped by province; you can also enter another city.
Do not map the original groups directly when using built-in filtering: the function child of Autocomplete.List receives the filtered groups. For object suggestions, provide itemToStringValue to define the text used for filtering and input completion, and pass the full item to Autocomplete.Item value.
Group and GroupLabel accept native props, refs, and className for custom spacing or heading styling. Group labels describe suggestions; they are not selectable options. Keep Autocomplete.Empty in the popup to explain when no group has matching results.
Opening
Section titled “Opening”The suggestion popup opens when the input receives focus. Set openOnFocus={false} when the list should wait for typing or Autocomplete.Trigger.
Focus the first field to open its suggestions. The second field stays closed until you type or press its trigger.
Focus opens the suggestions.
Focus keeps the list closed. Type or use the trigger.
Controlled value
Section titled “Controlled value”Use value and onValueChange when selection belongs to application state. Autocomplete.Clear resets the value through the same callback.
Selected: Jakarta
Motion
Section titled “Motion”Autocomplete.Content fades, scales, and moves from its resolved side when it opens, then reverses that movement when it closes. The animation uses the fast motion rhythm and automatically stands down for reduced-motion preferences.
Open both fields. The first popup animates in and out. disableMotion makes the second appear and disappear immediately.
Disabled and invalid
Section titled “Disabled and invalid”Place Autocomplete inside Field to share disabled and invalid semantics with its label, description, and error message. Hover, focus, invalid, and disabled treatments follow the Input spec: the input group owns the 2px focused border and pressed background (no inner focus ring on the text field or trigger). Invalid groups use the same danger-subtle border and accent red subtlest fill as Input.
Select a supported city.
Autocomplete.Root Autocomplete.InputGroup Autocomplete.Input Autocomplete.Trigger Autocomplete.Clear Autocomplete.Content Autocomplete.List Autocomplete.Item Autocomplete.Empty Autocomplete.Group Autocomplete.GroupLabel Autocomplete.Collection Autocomplete.Separator Autocomplete.Status
API
| Prop | Type | Default | Description |
|---|---|---|---|
value | ItemValue | — | Controlled input value. |
defaultValue | ItemValue | — | Initial uncontrolled value. |
onValueChange | (value: ItemValue) => void | — | Runs when selection changes. |
openOnFocus | boolean | true | Opens the suggestion popup when the input receives focus. Typing and Autocomplete.Trigger still open it when this is false. |
items | readonly ItemValue[] | readonly { items: readonly ItemValue[] }[] | — | Flat suggestions or groups containing suggestions. Groups may include labels and other metadata; List renders the filtered groups. |
itemToStringValue | (item: ItemValue) => string | — | Text used to filter and complete object suggestions. Receives individual suggestions, not their groups. |
Group.items | readonly ItemValue[] | — | The filtered suggestions for this group. Its nested Collection renders these items. |
GroupLabel.children | ReactNode | — | Visible heading and accessible name for a suggestion group. |
Collection.children | (item: ItemValue, index: number) => ReactNode | — | Renders the group's suggestions without an additional DOM wrapper. |
size | 'sm' | 'md' | 'lg' | md | Input group height (`Autocomplete.InputGroup` / `Autocomplete.Input`). |
variant | 'default' | 'filled' | 'none' | default | Surface treatment on `Autocomplete.InputGroup` (`default`, `filled`, or `none`). |
Content.disableMotion | boolean | false | Disables the popup enter and exit animation for this instance. |
className | string | — | Merged last on every part. Style InputGroup on the field and Content for the portaled popup. |
Content.positionerClassName | string | — | Classes on the positioning wrapper around the popup. |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”Autocomplete preserves Base UI’s combobox semantics, filtering, active-option announcements, and keyboard navigation. Provide a visible label through Field.Label, label icon-only trigger and clear controls, and keep empty-state text meaningful. In grouped lists, use GroupLabel so each group has an accessible name; arrow keys navigate its options and continue across group boundaries.