Practical guides

Design autocomplete for selecting a value

Autocomplete suggests values while someone types. It can help select a town or product from a long catalogue. Its usefulness also depends on data quality and what happens when no suggestion meets the need.

Go to the method

Laptop, phone and open notebook on a white table
Illustration

Define what input means

Decide whether the field accepts free text or requires a catalogue entry. Explain this near the label. Typing a string is not automatically selection: a town identifier needs the chosen record, not merely its displayed name.

Disambiguate repeated names with a useful detail, such as department, without collecting unnecessary information. Define accent, hyphen and alternate-name handling from the catalogue. Do not silently select the first suggestion when several remain plausible.

Allow exploration before acceptance

The W3C combobox pattern describes input associated with suggestions and interactions to explore, accept or leave them. Communicate expansion and the active option. Standard text editing should remain available.

Keep a highlighted suggestion distinct from an accepted value. When the list closes, the person should understand what will be submitted. Test keyboard selection, editing after selection and leaving the field without accepting an option.

Handle network and catalogue changes

A slow response for older input must not replace suggestions for newer text. Waiting, no match and service failure are different states. Provide another way forward when autocomplete is a convenience rather than an essential dependency.

An entry withdrawn between selection and submission needs server validation and an actionable response. Preserve other fields while the person selects again. Where results are limited, ask for a more specific search rather than presenting a partial list as complete.

Example: towns with the same name

Educational example: two suggestions share a name but belong to different departments. Each shows both details; submission uses the chosen identifier. Testing selects the second entry, edits the text and checks that the old identifier is not accidentally retained. Another test interrupts the network and checks recovery.

Reference documents

Content updated on October 7, 2026

Acceptance matrix to adapt to your project

These proposed checks use synthetic cases. Decide the required behaviour with the team, record the result and assign unresolved gaps before release.

Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.

Test cases, expected outcomes and useful evidence
CaseExpected outcomeEvidence to retain
Repeated nameSuggestions can be distinguishedLabels and chosen identifier
Responses out of orderOnly current suggestions appearTest request sequence
Editing after selectionText and identifier stay consistentDisplayed and submitted values
No matchAn explanation and next step existMessage and next action

Frequently asked questions

Why not automatically choose the first result?

A suggestion may not be the person’s choice. Silent selection can submit the wrong town or product.

Does visible text identify a record?

Not if names repeat or change. Use a stable reference and check its consistency with what is shown.

Does a short list need autocomplete?

A native select or visible choices may be simpler. Compare effort and frequency before building custom suggestions.