OGE logoOGE

Autocomplete

<oge-autocomplete> is a text editor with a filtered suggestion list: the committed value is the string itself, suggestions open while typing and picking one writes its display text. Use it when free text is valid and the list is assistance — reach for <oge-select-box> when the value must be an item.

text-valued WAI-ARIA combobox virtual scroll signal forms

Basic usage

Type to see suggestions (from minSearchLength = 1 character on). Enter or blur commits the text; picking a suggestion commits its display text. The chevron and field-click opening are off by default.

value: string [(value)]
value: ''

Suggestion tuning

minSearchLength keeps the list closed until enough is typed, maxItemCount caps it (default 10), searchMode switches contains/startswith and searchTimeout debounces the filter. groupBy and itemTemplate work exactly like the select box.

minSearchLength maxItemCount searchMode
At least 2 characters, top 5 matches

Force selection

forceSelection turns free text off: on blur, text that matches no suggestion reverts to the last committed value, and an exact match resolves to the item with its canonical casing. selectionChanged reports the picked item — or null once the text diverges.

forceSelection selectionChanged selectedItem
picked role: null

Virtual scrolling

virtualScroll windows the dropdown: 10 000 rows here, ~15 in the DOM inside a full-height spacer. Available on the select box, tag box and autocomplete alike — pass true or { itemHeight, overscan }. Raise maxItemCount on the autocomplete, which otherwise caps the list at 10. Rows get a fixed size-matched height; groupBy/wrapItemText are ignored while active.

virtualScroll 10k rows fixed itemHeight

Lazy & server-side data

A function as [items] loads once on first open with localized loading/error rows. For fully server-driven suggestions, listen to searchChanged, keep [items] in sync and flag [loading] while the request runs.

items: () => Promise searchChanged loading

Field chrome

The shared chrome applies unchanged: label modes, sizes, styling modes, clear button, hints and validation. showDropDownButton + openOnFieldClick opt into select-box-like opening.

labelMode showDropDownButton openOnFieldClick
Start typing to search

Keyboard & accessibility

WAI-ARIA combobox with aria-autocomplete="list" and aria-activedescendant — DOM focus never leaves the input. No suggestion is auto-activated: Enter without arrowing commits the typed text.

  • ↓/↑ open the list and move the active suggestion; PgUp/PgDn jump ten.
  • Enter commits the active suggestion — or the raw text when none is active. Esc closes the list first, then reverts the typed text.
  • Typing below minSearchLength closes the list; deleting all text keeps the last committed value until blur.