Autocomplete

You can get some recommended tips based on the current input.

Autocomplete component provides input suggestions. The fetch-suggestions attribute is a method that returns suggested input. In this example, querySearch(queryString, cb) returns suggestions to Autocomplete via cb(data) when suggestions are ready.

Custom template

Customize how suggestions are displayed.

Use scoped slot to customize suggestion items. In the scope, you can access the suggestion object via the item key.

Search data from server-side.

Autocomplete Attributes

NameDescriptionTypeAccepted ValuesDefault
placeholderthe placeholder of Autocompletestring——
clearablewhether to show clear buttonboolean—false
disabledwhether Autocomplete is disabledboolean—false
value-keykey name of the input suggestion object for displaystring—value
model-value / v-modelbinding valuestring——
debouncedebounce delay when typing, in millisecondsnumber—300
placementplacement of the popup menustringtop / top-start / top-end / bottom / bottom-start / bottom-endbottom-start
fetch-suggestionsa method to fetch input suggestions. When suggestions are ready, invoke callback(data:[]) to return them to AutocompleteFunction(queryString, callback)——
popper-classcustom class name for autocomplete's dropdownstring——
trigger-on-focuswhether show suggestions when input focusboolean—true
namesame as name in native inputstring——
select-when-unmatchedwhether to emit a select event on enter when there is no autocomplete matchboolean—false
labellabel textstring——
hide-loadingwhether to hide the loading icon in remote searchboolean—false
popper-append-to-body(deprecated)whether to append the dropdown to body. If the positioning of the dropdown is wrong, you can try to set this prop to falseboolean—false
teleportedwhether select dropdown is teleported to the bodybooleantrue / falsetrue
highlight-first-itemwhether to highlight first item in remote search suggestions by defaultboolean—false
fit-input-widthwhether the width of the dropdown is the same as the inputboolean—false
input-stylethe style of the input element or textarea elementobject-{}
textarea-classthe custom CSS class for textarea elementstring--
prefix-classthe custom CSS class for prefix elementstring--
suffix-classthe custom CSS class for suffix elementstring--
prepend-classthe custom CSS class for prepend elementstring--
append-classthe custom CSS class for append elementstring--
roundedrounded inputboolean-false
smallsmall inputboolean-false
largelarge inputboolean-false

Autocomplete Slots

NameDescription
—Custom content for input suggestions. The scope parameter is { item }
prefixcontent as Input prefix
suffixcontent as Input suffix
prependcontent to prepend before Input
appendcontent to append after Input

Autocomplete Events

NameDescriptionParameters
selecttriggers when a suggestion is clickedsuggestion being clicked
changetriggers when the icon inside Input value change(value: string | number)

Autocomplete Methods

MethodDescriptionParameters
focusfocus the input element—
blurblur the input element—
Last Updated:
Contributors: Tam Mai