Autocomplete
Extended input that provide suggestions while the user types
Class props
Autocomplete component
Extended input that provide suggestions while the user types
html
<o-autocomplete></o-autocomplete>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
animation | Transition name to apply on dropdown list | string | - | From config: autocomplete: { |
autocomplete | Native options to use in HTML5 validation | string | - | From config: autocomplete: { |
checkScroll | Makes the component check if list reached scroll start or end and emit scroll events. | boolean | - | From config: autocomplete: { |
clearIcon | Icon name to be added on the clear button | string | - | From config: autocomplete: { |
clearOnSelect | Clear input text on select | boolean | - | From config: autocomplete: { |
clearable | Add a button/icon to clear the inputed text | boolean | - | From config: autocomplete: { |
confirmKeys | Array of keys (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) which will add a tag when typing (default tab and enter) | string[] | - | From config: autocomplete: { |
data | Options / suggestions | T[] | - | Default function (see source code) |
debounce | Number of milliseconds to delay before to emit input event | number | - | From config: autocomplete: { |
disabled | Same as native input disabled | boolean | - | false |
expanded | Makes input full width when inside a grouped or addon field | boolean | - | false |
field | Property of the object (if data is array of objects) to use as display text, and to keep track of selected option | string | - | |
formatter | Function to format an option to a string for display in the input (as alternative to field prop) | (value: unknown) => string | number | - | |
groupField | Property of the object (if data is array of objects) to use as display text of group | string | - | |
groupOptions | Property of the object (if data is array of objects) to use as key to get items array of each group | string | - | |
icon | Icon to be shown | string | - | From config: autocomplete: { |
iconClickable | Makes the icon clickable | boolean | - | false |
iconPack | Icon pack to use | string | mdi , fa , fas and any other custom icon pack | From config: autocomplete: { |
iconRight | Icon to be added on the right side | string | - | From config: autocomplete: { |
iconRightClickable | Make the icon right clickable | boolean | - | false |
iconRightVariant | Variant of right icon | string | - | |
itemTag | Menu item tag name | DynamicComponent | - | From config: autocomplete: { |
keepFirst | The first option will always be pre-selected (easier to just hit enter or tab) | boolean | - | From config: autocomplete: { |
keepOpen | Keep open dropdown list after select | boolean | - | From config: autocomplete: { |
maxHeight | Max height of dropdown content | string|number | - | From config: autocomplete: { |
maxlength | Same as native maxlength, plus character counter | string|number | - | |
menuTag | Menu tag name | DynamicComponent | - | From config: autocomplete: { |
mobileModal | Dropdown content (items) are shown into a modal on mobile | boolean | - | From config: autocomplete: { |
openOnFocus | Open dropdown list on focus | boolean | - | From config: autocomplete: { |
override | Override existing theme classes completely | boolean | - | |
placeholder | Input placeholder | string | - | |
position | Position of the dropdown | string | auto , top , bottom | From config: autocomplete: { |
rounded | Makes the element rounded | boolean | - | false |
selectOnClickOutside | Trigger the select event for the first pre-selected option when clicking outside and keep-first is enabled | boolean | - | false |
selectableFooter | Allows the footer in the autocomplete to be selectable | boolean | - | false |
selectableHeader | Allows the header in the autocomplete to be selectable | boolean | - | false |
size | Size of the control | string | small , medium , large | From config: autocomplete: { |
statusIcon | Show status icon using field and variant prop | boolean | - | From config: { |
teleport | Append the component to another part of the DOM. Set true to append the component to the body.In addition, any CSS selector string or an actual DOM node can be used. | boolean|string|object | - | From config: autocomplete: { |
type | Input type | string | - | "text" |
useHtml5Validation | Enable html 5 native validation | boolean | - | From config: { |
v-model | string|number | - | ||
validationMessage | The message which is shown when a validation error occurs | string | - |
Events
Event name | Properties | Description |
---|---|---|
icon-click | event Event - native event | on icon click event |
update:modelValue | value string | number - updated modelValue prop | modelValue prop two-way binding |
input | value string | number - input value | on input change event |
select | value string | number | object - selected value | selected element changed event |
select-header | event Event - native event | header is selected |
select-footer | event Event - native event | footer is selected |
focus | event Event - native event | on input focus event |
blur | event Event - native event | on input blur event |
invalid | event Event - native event | on input invalid event |
icon-right-click | event Event - native event | on icon right click event |
scroll-start | the list inside the dropdown reached the start | |
scroll-end | the list inside the dropdown reached it's end |
Slots
Name | Description | Bindings |
---|---|---|
header | Define an additional header | |
group | Override the option grpup | group object - options groupindex number - option index |
default | Override the select option | option object - option objectvalue unknown - option valueindex number - option index |
empty | Define content for empty state | |
footer | Define an additional footer |
Sass variables
Current theme ➜ Oruga Base
SASS Variable | Default |
---|---|
$autocomplete-item-color | #000000 |
$autocomplete-item-disabled-opacity | $base-disabled-opacity |
$autocomplete-item-font-size | $base-font-size |
$autocomplete-item-hover-background-color | #f5f5f5 |
$autocomplete-item-hover-color | #000000 |
$autocomplete-item-line-height | $base-line-height |
$autocomplete-item-padding | 0.375rem 1rem |
See ➜ 📄 Full scss file
Current theme ➜ Oruga Full
SASS Variable | Default |
---|---|
$autocomplete-item-color | #000000 |
$autocomplete-item-disabled-opacity | $base-disabled-opacity |
$autocomplete-item-font-size | $base-font-size |
$autocomplete-item-hover-background-color | #f5f5f5 |
$autocomplete-item-hover-color | #000000 |
$autocomplete-item-line-height | $base-line-height |
$autocomplete-item-padding | 0.375rem 1rem |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
The theme does not have any custom variables for this component.
Current theme ➜ Bootstrap
SASS Variable | Default |
---|---|
$autocomplete-menu-max-height | 200px |
See ➜ 📄 Full scss file