dcx-typeahead
v0.10.4
Published
Typeahead/autosuggest plugin for Ajax-datasources
Downloads
15
Readme
Typeahead/autosuggest plugin for Ajax-datasources
Best used in combination with dcx-wasabi
Installation
npm install -D dcx-typeahead
Usage
Include the typeahead plugin:
const typeahead = require('dcx-typeahead')
Instantiate the plugin on a text input:
typeahead(document.querySelector('input[type="text"]') [,options, project])
Arguments
options
The following options can be passed in as an object:
Option | Description | Default
--- | --- | ---
autosuggest.template | Template used to render the results in the autosuggest | <li>{{suggest}}</li>
autosuggest.maxResults | Number of results that are parsed in the autosuggest list | 5
autosuggest.resultsMaxHeight | Height in pixels necessary to show the results below the input field | 100
class | Object with classes added to the typeahead elements. | { activeItem: 'typeahead-is-active'/*added to an active item in the autosuggest list*/, input: 'typeahead-input', ul: 'typeahead-ul'}
url | Url to the backend service to provide the results | null
minChars | Number of total chars to type before search is performed | 2
project
If the project object is passed in, the url will be populated from the project settings