You can add your custom header to the autocomplete.
Autocomplete
Extended input that provide suggestions while the user types. Use with Field to access all functionalities
Selected:
# Object array
Selected:
# Header
Selected:
You can add your custom footer to the autocomplete.
Selected:
# Groups
You can show options by groups
Selected:
# Keep First
You can select the first option when pressing enter or tab with keep-first
.
Additionally, use select-on-click-outside
to automatically select the first element when clicking outside of the input
element.
Selected:
# Async with custom template
You can have a custom template by adding a scoped slot to it.
API from TMDb.
Selected:
# Async with infinite scroll
With check-infinite-scroll
and infinite-scroll
event you can listen to the end of the scroll list to implement an infinite scroll strategy.
API from TMDb.
Selected:
# API
Name | Description | Type | Values | Default |
---|---|---|---|---|
v-model | Binding value | String, Number | — | — |
data | Options / suggestions | Array | — | — |
field | Property of the object (if data is array of objects) to use as display text, and to keep track of selected option | String | — | value |
custom-formatter | Function to format an option to a string for display in the input as alternative to field prop) | Function | — | |
group-field | Property of the object (if data is array of objects) to use as display text of group | String | — | |
group-options | Property of the object (if data is array of objects) to use as key to get items array of each group, optional | String | — | |
clear-on-select | Clear input text on select | Boolean | — | false |
open-on-focus | Open dropdown list on focus | Boolean | — | false |
keep-first | The first option will always be pre-selected (easier to just hit enter or tab) | Boolean | — | false |
size | Vertical size of input, optional | String | is-small , is-medium , is-large | — |
expanded | Makes input full width when inside a grouped or addon field | Boolean | — | false |
loading | Add the loading state to the input | Boolean | — | false |
icon | Icon name to be added | String | — | — |
icon-pack | Icon pack to use | String | mdi , fa , fas , far , fad , fal | mdi |
confirm-keys | Array of keys (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) which will select an option when typing (default tab and enter) | Array | — | ["Tab", "Enter"] |
clearable | Add a button to clear the inputed text | Boolean | — | false |
icon-right | Icon name to be added on the right side | String | — | — |
maxlength | Same as native maxlength , plus character counter | String, Number | — | — |
check-infinite-scroll | Makes the component check if list reached scroll end and emit infinite-scroll event. | Boolean | — | false |
max-height | Max height of dropdown content | String, Number | — | 200px |
dropdown-position | Position of dropdown | String | top , bottom , auto | auto |
append-to-body | Append autocomplete content to body (prevents event bubbling) | Boolean | — | false |
select-on-click-outside | Trigger the @select event for the first pre-selected option when clicking outside and keep-first is enabled | Boolean | — | false |
selectable-header | Allows the header in the autocomplete to be selectable | Boolean | — | false |
selectable-footer | Allows the footer in the autocomplete to be selectable | Boolean | — | false |
Any native attribute | — | — | — | — |
# Variables
You can use these variables to customize this component.
Name | Default |
---|---|
$dropdown-content-max-height | 200px |
This page is open source. Noticed a typo or something's unclear?