Guide

Autocomplete, end to end

What @samline/autocomplete does, how its combobox behaves and where to find installation, examples, options and the complete API.

@samline/autocomplete turns an existing text input into an accessible combobox that searches a remote endpoint, an async function or a local array. You own the data and its shape; the package owns debounce, cancellation, request ordering, caching, accent-insensitive matching, highlighting, the listbox, keyboard interaction, announcements, events and cleanup.

Choose your next step

How a search works

  1. Typing schedules a search after debounce ms once the query reaches minLength characters.
  2. A new search aborts the previous request; responses that arrive late are ignored.
  3. The response goes through parseResponse and mapResponse, then the first maxResults suggestions are rendered as options.
  4. Choosing an option writes getValue(suggestion) into the input, closes the list and dispatches autocomplete:select.
  5. Escape, Tab, clicking outside, selecting or close() cancel the pending search and abort the request in flight.