v1.2.0

Autocomplete

The autocomplete is a text input enhanced by a panel of suggested options.

Basic

<me-autocomplete label="Movie" options='["The Godfather","Pulp Fiction","Schindler's List"]'></me-autocomplete>

With Options

<me-autocomplete label="Country" options='["France","Germany","Spain"]'></me-autocomplete>

Controlled Value

Set value as an attribute or property to pre-select an option. Listen to me-change to track user selections. You can also drive the selection programmatically.

Set Vue Set Angular Clear
me-change fired with:
<me-autocomplete id="ac" label="Framework" value="React" options='["React","Vue","Angular","Svelte"]'></me-autocomplete> <script> // Listen for user selection document.getElementById('ac').addEventListener('me-change', e => { console.log(e.detail.value); // "Vue" }); // Drive value programmatically document.getElementById('ac').value = 'Vue'; </script>

Object Options

<me-autocomplete label="Film" options='[ {"label":"The Godfather","value":"godfather"}, {"label":"Pulp Fiction","value":"pulp-fiction"} ]'></me-autocomplete>

Disabled

API

AttributeTypeDefaultDescription
optionsJSON string | string[] | {label,value}[]Options to display in the dropdown.
valuestringCurrently selected value.
labelstringFloating label text.
placeholderstringInput placeholder.
disabledbooleanfalseDisables the input.

Events

EventDetailDescription
me-change{ value: string, label: string }Fired when the user selects an option.