Skip to Content
Selection & Dates@hacline/ui/autocomplete

Autocomplete

Provide suggestions for free-form text input.

Usage

Typing "Design" shows matching tags, while new terms can be kept directly as entered. When items is provided, an empty AutocompleteList renders the current suggestions.

Controlled Input and Clearing

Synchronize application state with value and clear the input with AutocompleteClear. This example matches only cities starting with the entered text.

City: Seattle

Parts

PartDescriptionExtended Props
AutocompleteArrow
An arrow on the popup's edge that points at the field.—
AutocompleteClear
A button that empties the field. Shown while there's text to clear. Name it with aria-label.—
AutocompleteContent
The popup that holds the suggestions, positioned against the field.—
AutocompleteEmpty
Shown while no suggestion matches. Its message is announced when it appears.—
AutocompleteGroup
A group of items, named by its AutocompleteGroupLabel, and hidden while none of its items shows.—
AutocompleteGroupLabel
The group's heading, which names the group.—
AutocompleteInput
The text field. It's the form control, so the text submits under the autocomplete's name.
size
AutocompleteItem
A suggestion. Choosing it fills the field in with its text.—
AutocompleteItemIcon
An icon inside a suggestion. Screen readers, typeahead and filtering skip it, and mirror flips it in right-to-left text.—
AutocompleteItems
Renders data suggestions. Used by data autocompletes, and available for custom layouts.—
AutocompleteItemText
The suggestion's text, with the part the field's text matched in <mark>. Without string content, it shows the suggestion's label.—
AutocompleteLabel
A visible label for the field.—
AutocompleteList
The listbox. Without children, it renders the autocomplete's items, filtered.—
AutocompleteSeparator
A line between items or groups, hidden from screen readers.—
AutocompleteStatus
A polite live region for loading and result counts. Its content is yours, usually a function of its state.—
AutocompleteTrigger
A button that opens and closes the suggestions, out of the tab order.
size

Props

Prop

Type

View UI SDK parts and state attributes.