Autocomplete
Autocomplete component binds to a text field and offers suggestions to the user while typing based on a static list of results or an Ajax call.
Basic Usage
As long as this component is rendered by Vue it will capture all Ajax calls.
Vue Properties
Vue Property | Type | Default Value | Description |
---|---|---|---|
min-characters | Number | 1 | How many minimum characters can trigger component to suggest something? |
max-results | Number | 6 | How many results can we display at a time? |
delay | Number | 500 | How many milliseconds to wait before triggering a suggestion? |
static-data | Object | None | Use static suggestions. No need to do an Ajax call. Filtering is provided by Autocomplete component. |
delimiter | Boolean | false | Should suggestions popover display a delimiter between results? |
When using static data, specify an Object this (notice that it uses ListItem component props):
Vue Methods
Only if you want to also trigger it manually. Ajax calls trigger these methods automatically.
Vue Method | Description |
---|---|
trigger() | Trigger suggestions. |
close() | Close suggestions popover. |
setValue() | Set textfield string to the value supplied. |
move(offset) | Move selection cursor on suggestions popover by offset (Number, example: 3 for three selections down, -1 for one selection up). |
Vue Events
Vue Event | Description |
---|---|
@search(terms, Function done) | Triggered by the component when a search should start and offer some results. |
@selected(item) | Triggered when user has selected a suggestion. |
@open | Triggered when the selections pop-up opens. |
@close | Triggered when selections pop-up closes. |
Example for search
event: