Select V2 virtualized selector beta

TIP

This component is still under testing, if you found any bug or issue please report it at GitHub for us to fix.

TIP

This component requires the <client-only></client-only> wrap when used in SSR (eg: Nuxt) and SSG (eg: VitePress).

Background

In some use-cases, a single selector may end up loading tens of thousands of rows of data. Rendering that much data into the DOM could be a burden to the browser, which can result in performance issues. For a better user and developer experience, we decided to add this component.

Basic usage

The simplest selector

Multi select

The basic multi-select selector with tags

Hide extra tags when the selected items are too many.

You can collapse tags to a text by using collapse-tags attribute. You can check them when mouse hover collapse text by using collapse-tags-tooltip attribute.

Filterable multi-select

When the options are overwhelmingly too many, you can use filterable option to enable filter feature for finding out the desired option

Disabled selector and select options

You can choose to disable selector itself or the option.

Option Grouping

We can group option as we wanted, as long as the data satisfies the pattern.

Customized option renderer

We can define our own template for rendering the option in the popup.

Clearable selector

We can clear all the selected options at once, also applicable for single select.

Create Option

Create and select new items that are not included in select options

By using the allow-create attribute, users can create new items by typing in the input box. Note that for allow-create to work, filterable must be true.

TIP

It will be better to set :reserve-keyword="false" when use allow-create

Enter keywords and search data from server.

Use value-key attribute

when options.value is an object, you should set a unique identity key name for value

TIP

Before 2.4.0, value-key was used both as the unique value of the selected object and as an alias for the value in options. Now value-key is only used as the unique value of the selected object, and the alias for the value in options is props.value.

Aliases for custom options 2.4.2

When your options format is different from the default format, you can customize the alias of the options through the props attribute

SelectV2 Attributes

NameDescriptionTypeAccepted ValuesDefault
model-value / v-modelbiding valuestring / number / boolean / object
optionsdata of the options, the key of value and label can be customize by propsArray
props 2.4.2configuration options, see the following tableobject
multipleis multiplebooleanfalse
disabledis disabledbooleanfalse
value-keyunique identity key name for value, required when value is an objectstringvalue
sizeinput box sizestringlarge/default/smalldefault
clearablewhether select can be clearedbooleanfalse
clear-iconcustom clear iconstring | ComponentCircleClose
collapse-tagswhether to collapse tags to a text when multiple selectingbooleanfalse
multiple-limitmaximum number of options user can select when multiple is true. No limit when set to 0number0
namethe name attribute of select inputstring
effectTooltip theme, built-in theme: dark / lightstringstringlight
autocompleteautocomplete of select inputstringoff
placeholderplaceholderstringPlease select
filterableis filterablebooleanfalse
allow-createwhether creating new items is allowed. To use this, filterable must be truebooleanfalse
reserve-keywordwhether reserve the keyword after select filtered option.booleantrue
no-data-textdisplayed text when there is no options, you can also use slot emptystringNo Data
popper-classcustom class name for Select's dropdownstring
popper-append-to-body deprecatedwhether to append the popper menu to body. If the positioning of the popper is wrong, you can try to set this prop to falseboolean-false
teleportedwhether select dropdown is teleported to the bodybooleantrue / falsetrue
persistentwhen select dropdown is inactive and persistent is false, select dropdown will be destroyedbooleantrue / falsetrue
popper-optionsCustomized popper option see more at popper.jsobject--
automatic-dropdownfor non-filterable Select, this prop decides if the option menu pops up when the input is focusedboolean-false
heightThe height of the dropdown panel, 34px for each itemnumber-170
item-heightThe height of the dropdown itemnumber-34
scrollbar-always-onControls whether the scrollbar is always displayedboolean-false
remotewhether search data from serverbooleanfalse
remote-methodfunction that gets called when the input value changes. Its parameter is the current input value. To use this, filterable must be truefunction(keyword: string)
validate-eventwhether to trigger form validationboolean-true
placementposition of dropdownstringtop/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-endbottom-start
collapse-tags-tooltip 2.3.0whether show all selected tags when mouse hover text of collapse-tags. To use this, collapse-tags must be truebooleantrue / falsefalse
max-collapse-tags 2.3.0The max tags number to be shown. To use this, collapse-tags must be truenumber1

props

AttributeDescriptionTypeDefault
valuespecify which key of node object is used as the node's valuestringvalue
labelspecify which key of node object is used as the node's labelstringlabel
optionsspecify which key of node object is used as the node's childrenstringoptions
disabledspecify which key of node object is used as the node's disabledstringdisabled

SelectV2 Events

NameDescriptionParams
changetriggers when the selected value changescurrent selected value
visible-changetriggers when the dropdown appears/disappearstrue when it appears, and false otherwise
remove-tagtriggers when a tag is removed in multiple moderemoved tag value
cleartriggers when the clear icon is clicked in a clearable Select
blurtriggers when Input blurs(event: FocusEvent)
focustriggers when Input focuses(event: FocusEvent)

SelectV2 Slots

NameDescription
defaultOption renderer
emptycontent when options is empty
prefixprefix content of input