Skip to content

Autocomplete

Type to filter suggestions, pick with keyboard or pointer — or keep typing. Any text submits: the visible input itself carries the form name.

Combobox vs Autocomplete: Combobox values must come from the list (a hidden input carries the value; stray text reverts on blur). Autocomplete allows free text (the named input carries the value; blur keeps whatever is typed).

Example

<Autocomplete
  id="city"
  label="City"
  name="city"
  options={["New York", "York", "Newark"]}
/>

Props

PropTypeDefaultDescription
idstring-Input id; label targets it.
labelstring-Visible label.
namestringidVisible input form name; submits free text.
optionsArray<string | { value; label; disabled? }>-Suggestion items.
valuestring""Initial text; option values resolve to labels.
placeholderstring-Input placeholder.
classstring-Style passthrough.
Plus the Field API (hint, error, required, disabled).

Accessibility