Appearance
API Reference
Props
model-value
Type:
(OptionType)[]ifmultipleistrue(OptionType | EmptyModelValueType)ifmultipleisfalse
Details:
Required.
The selected options.
empty-model-value
Type:
EmptyModelValueType = anyDefault:
nullDetails:
Only works if
multipleisfalse.If there is no selecting option,
update:modelValueevent will emit this value.
options
Type:
OptionType[] = any[]Details:
Required.
visible-options
Type:
OptionType[]Details:
This would be useful if you have options, but you only want to display partial of those option.
You could use this feature to implement customize filtering, remote searching, etc.
Options in
optionsandvisible-optionsmust be the same raw object.
disabled
Type:
booleanDefault:
falseWhether to disable the select.
loading
Type:
booleanDefault:
falseWhether to show the loading spinner.
label-by
Type:
string | (option => string)Details:
This will be used in dropdown and tags.
It accepts path, or function to locate the label.
For example, if you have options like this:
[{ details: { name: 'bar' } }]You could pass
details.nameoroption => option.detail.nameto set label to'bar'.
value-by
Type:
string | (option => string)Details:
Same as
label-bybut forvalue
disabled-by
Type:
string | (option => boolean)Default:
'disabled'Details:
Same as
label-bybut fordisabled
group-by
Type:
string | (option => boolean)Default:
'group'Details:
Same as
label-bybut forgroupIf one option is group, its
valuemust be typeOptionType[].When a group option is selected, those
values will be selected, and if all of thosevalues are already selected, it will be deselected.
placeholder
Type:
stringDefault:
'Select option'
searchable
Type:
booleanDefault:
falseDetails:
When
true,options(orvisible-optionsif passed) will be filtered by the search text.
search-placeholder
Type:
stringDefault:
'Type to search'
clear-on-close
Type:
booleanDefault:
falseDetails:
Whether to clear search text after collapsing dropdown.
clear-on-select
Type:
booleanDefault:
falseDetails:
Whether to clear search text after selected/removed.
multiple
Type:
booleanDefault:
false
min
Type:
numberDefault:
0Details:
If
multipleisfalse,0means clearable,1means non-clearable.
max
Type:
booleanDefault:
InfinityDetails:
Only works if
multipleistrue.
taggable
Type:
booleanDefault:
falseDetails:
Only works if
multipleistrue.
collapse-tags
Type:
booleanDefault:
falseOnly works if
taggableistrue.
hide-selected
Type:
booleanDefault:
falseDetails:
Only works if
multipleistrue.Whether to Hide already selected options in the dropdown.
close-on-select
Type:
booleanDefault:
falseDetails:
Whether to collapse dropdown after selected/removed.
maxHeight
New in v2.5.0+
Type:
numberDefault:
300Details:
Max height of dropdown.
openDirection
New in v2.5.0+
Type:
'top' | 'bottom'Details:
Fixed opening direction.
If it is not set, it will be automatically calculated based on
maxHeight.
Events
update:modelValue
Arguments:
{(OptionType | EmptyModelValueType) | (OptionType | EmptyModelValueType)[]}modelValue
selected
Arguments:
{OptionType}option
removed
Arguments:
{OptionType}option
opened
Warning: deprecated, use
focusinstead.
closed
Warning: deprecated, use
blurinstead.
focus
New in v2.4.0+
blur
New in v2.4.0+
toggle
New in 2.6.0+
search:input
Arguments:
{Event}event
search:change
Arguments:
{Event}event
search:focus
Arguments:
{Event}event
search:blur
Arguments:
{Event}event
Slots
dropdown-item
Attributes:
{OptionType}option
label
New in v2.9.0+
Attributes:
{(OptionType | EmptyModelValueType) | (OptionType | EmptyModelValueType)[]}selected
tag
Attributes:
{OptionType}option{Function}removeNew in
v2.7.0+
toggle
Attributes:
{boolean}isFocusing{Function}toggle
When using this slot, you often need to bind the
togglefunction to click event or else to enable open/close functionality.In addition, you may also have to prevent mousedown event by adding
@mousedown.preventto prevent default behavior (fire focus event). See more details here.