The most basic autocomplete input on the web. Comes as a single JS file that doesn't depend on anything.
textInput = document.querySelector('input[name=tags]')
new SuggestiveTextField(textInput, ['monster', 'monstrosity', 'trap'])
new SuggestiveTextField(textInput, null,
suggestionsForToken: (token) =>
new Promise((resolve, reject) =>
$.getJSON(remoteUrlFor(token), (response) => resolve(response.results))
)
SuggestiveTextField(textInput, suggestions, {
tokenSeparator: ', ', // pass false to disallow multiple selections whatsoever
suggestionsForToken: function (token) {
// return suggestions that start with `token`
},
onConfirmHook: function (selectedSuggestion) {
// do something extra when a suggestion is selected
}
})
blade runner
to run the tests in the browser
blade build
to re-compile the dist/