A dataset is an object that defines a set of data that hydrates suggestions. Typeaheads can be backed by multiple datasets. Given a query, a typeahead instance will inspect its backing datasets and display relevant suggestions to the end-user.
The template engine used to compile/render template if it is a string. Any engine can use used as long as it adheres to the expected API. Required if template is a string.
The footer rendered after suggestions in the dropdown menu. Can be either a DOM element or HTML.
The header rendered before suggestions in the dropdown menu. Can be either a DOM element or HTML.
The max number of suggestions from the dataset to display for a given query. Defaults to 5.
An array of datums or strings.
The string used to identify the dataset. Used by typeahead.js to cache intelligently.
Can be a URL to a JSON file containing an array of datums or, if more configurability is needed, a prefetch options object.
Can be a URL to fetch suggestions from when the data provided by local and prefetch is insufficient or, if more configurability is needed, a remote options object.
The template used to render suggestions. Can be a string or a precompiled template. If not provided, suggestions will render as their value contained in a
element (i.e.
value
).The key used to access the value of the datum in the datum object. Defaults to value.