Design Typeahead Around How Matching Actually Works
Search & Discovery · search, forms, latency
Updated 2026-08-04
- Know whether your suggestions match from the start of a word or from anywhere inside it. A trie makes prefix matching fast and predictable, and it means typing "book" will never suggest "Facebook", which users read as missing data.
- Match on every word in the entry, not just the first. Someone typing "smith" should find "Alice Smith", and a system that only matches the leading character of the whole string will not.
- Set the trigger threshold to fit the content. One character in a list of forty items is helpful, and one character across a million records returns everything and helps nobody.
- Wait for a pause before querying, and cancel what is in flight. Firing on every keystroke costs a request per character and delivers results in the wrong order.
- Never reorder the list under a moving hand. Suggestions that reshuffle between the eye and the click are how people select the wrong item.
- Show what was matched. Highlighting the matched portion tells the user why this entry is here and how to narrow further.
- Keep typing possible when nothing matches. An empty suggestion list should not clear the field, block submission, or steal focus.
- Handle the three cases the user will meet:
- Too many matches, where the list needs a count and a way to narrow.
- One match, which should be easy to accept without a second decision.
- No matches, which needs a route to a full search or to creating the item.
- Rank recent and frequent choices first. Prefix matching decides what is possible, and usage decides what is useful.
Typeahead feels intelligent only when its matching rule is simple enough that a user learns it in three keystrokes.
Related guides