Autocomplete

Get some recommended tips based on the current input.

Basic Usage

Autocomplete component provides input suggestions.

Custom template

Customize how suggestions are displayed.

Search data from server-side.

API

Attributes

NameDescriptionTypeDefault
placeholderthe placeholder of Autocompletestring
clearablewhether to show clear buttonbooleanfalse
disabledwhether Autocomplete is disabledbooleanfalse
value-keykey name of the input suggestion object for displaystringvalue
model-value / v-modelbinding valuestring
debouncedebounce delay when typing, in millisecondsnumber300
placementplacement of the popup menuenumbottom-start
fetch-suggestionsa method to fetch input suggestions. When suggestions are ready, invoke callback(data:[]) to return them to AutocompleteFunction
popper-classcustom class name for autocomplete's dropdownstring
trigger-on-focuswhether show suggestions when input focusbooleantrue
namesame as name in native inputstring
select-when-unmatchedwhether to emit a select event on enter when there is no autocomplete matchbooleanfalse
labellabel textstring
hide-loadingwhether to hide the loading icon in remote searchbooleanfalse
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 falsebooleanfalse
teleportedwhether select dropdown is teleported to the bodybooleantrue
highlight-first-itemwhether to highlight first item in remote search suggestions by defaultbooleanfalse
fit-input-widthwhether the width of the dropdown is the same as the inputbooleanfalse

Events

NameDescriptionType
selecttriggers when a suggestion is clickedFunction
changetriggers when the icon inside Input value changeFunction

Slots

NameDescription
defaultCustom content for input suggestions. The scope parameter is
prefixcontent as Input prefix
suffixcontent as Input suffix
prependcontent to prepend before Input
appendcontent to append after Input

Instance Exposes

NameDescriptionType
activatedif autocomplete activatedObject
blurblur the input elementFunction
closecollapse suggestion listFunction
focusfocus the input elementFunction
handleSelecttriggers when a suggestion is clickedFunction
handleKeyEnterhandle keyboard enter eventFunction
highlightedIndexthe index of the currently highlighted itemObject
highlighthighlight an item in a suggestionFunction
inputRefel-input component instanceObject
loadingremote search loading indicatorObject
popperRefel-tooltip component instanceObject
suggestionsfetch suggestions resultObject

Source

ComponentDocs

Contributors