Autocomplete

Autocomplete facilitates the selection of a single item from a list of suggestions.

Overview

Autocomplete relies on developers to provide a list of suggestions to the user. The user can then select a single suggestion from the list.

Usage

  • Filtering and searching long lists
  • Returning items to a user based on input

Sample

Best practices

While visually similar to the Combobox, the Autocomplete component has distinct capabilities and intended use cases.

Comparison

AutocompleteThis component
Most often used with very long or unpredictable lengths of items.
Best for programmatically returning responses based on user input.
Does not accept custom values or multiple selections.
ComboboxAlternative
Most often used when the workflow requires multiple selections.
Best when the number of selectable items is finite and small.
Often used for accepting custom values and both single and multiple selection .

Recommendations

Do use Autocomplete when there are an unknown or large number of items or records.
Do use Autocomplete when the user can select a single choice.
Avoid using Autocomplete for a known, small number of records.
Avoid using Autocomplete when there is a need to select multiple items.

Accessibility

Keyboard navigation

KeyFunction
BackspaceWhen the component is focused and contains a selected calcite-autocomplete-item will remove the most recently added from the component.
SpaceIf the component is not open, opens the component.
Arrow upIf the component is open and in focus, moves focus to previous calcite-autocomplete-item. If the current focus is the first calcite-autocomplete-item.
Arrow downIf the component is open and in focus, move focus to next calcite-autocomplete-item. If the current focus is the last calcite-autocomplete-item, focus will cycle to the first calcite-autocomplete-item.
EnterIf the component is open and a calcite-autocomplete-item is active, will select the item.
EscIf the component is open, closes the component.
TabMoves focus in and out of the component. If the component is not open and calcite-autocomplete-items are present, the component will open. If the component is open, the component will close.
Tab and ShiftMoves focus in and out of the component. If the component is not open and calcite-autocomplete-item's are present, the component will open. If the component is open, the component will close.
HomeMoves focus to the first calcite-autocomplete-item, if present. If the component is not open and calcite-autocomplete-item's are present, the component will open.
EndMoves focus to the last calcite-autocomplete-item, if present. If the component is not open and calcite-autocomplete-item's are present, the component will open. If the component is open, the component will close.

API reference

Properties

Slots

Styles

Events

Methods

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.