Form input

Autocomplete

Search and select without mixing the query draft with committed values.

Autocomplete at a glance

MAutocomplete is MDropdown with a query: the same field, panel, selection and chips, plus a filter driven by what the user types.

  • One familyItems, `multiple`, `mandatory`, `max`, `clearable`, `menuPlacement` and `maxHeight` come from the dropdown; only filtering is new.
  • Draft is not valueWhat the user types is a draft. It is put back on blur, Escape or Tab, so a half-typed query never leaks into the model.
  • IME-safeWhile an input method is composing, Enter belongs to the IME and not to the listbox.

A quick look

A single-select autocomplete over `{ id, label }` items.

01

Items carry an id

Every item needs an `id`. Values are compared by it, so a refetched list keeps its selection.

02

Pick the filter

`filterMode` is `contains` or `starts-with`. Pass a function for custom matching, or `false` when the server already filtered.