Text input for searching values or getting suggestions
||String||The source of data to query for matches. This must be the id of a
||Number||Truncates the number of results to
An object with properties:
|Fired after a match was selected by the user.|
Creating data sources
Sources can come from one of two places:
1. Custom source function
These are async functions added to the global
MdashAutocomplete.prototype.sources object. Here's an example
fruit source similar to the demo above:
const matches = cache[query] || await fetchAndCacheResults(query). You can also use
max if it's beneficial while searching to know the maximum number of matches that will be shown.
2. Datalist element
Include a standard data list element in the DOM and autocomplete will search the option's values for matches. Here's an example:
There are no extra recommendations for Autocomplete.