Select V2 virtualized selectorbeta

TIP

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

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

SelectV2 Attributes

NameDescriptionTypeAccepted ValuesDefault
model-value / v-modelbiding valuestring / number / boolean / object
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
collapse-tags-tooltipwhether show all selected tags when mouse hover text of collapse-tags. To use this, collapse-tags must be truebooleantrue / falsefalse
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
placeholderthe autocomplete attribute of select inputstringPlease 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(deprecated)whether 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
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

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

Source

ComponentDocs

Contributors