Skip to content
🌏 Translated with the assistance of DeepSeek and ChatGPT

Select

A common selector that presents and selects content via a drop-down menu.

Basic Usage

Pass modelValue to enter controlled mode.
Omit it or pass undefined for uncontrolled mode, in which you can supply a defaultValue prop as the initial value.

Vue
Vue
Hide source code

Disabled Options

Inside options, set an option's disabled field to true to disable that option.

Vue
Vanilla
Hide source code

Groups

The options array also supports option groups.

Vue
Hide source code

Remote Loading

Set the loading prop and listen to the focus event to reflect UI changes while data is being fetched or searched.

Please Select
Hide source code

Multiple Selection

Add the multiple prop to enable multi-select mode.

Please Select
Hide source code

Collapsed Tags

In multi-select mode, set collapseTags to true (default false) to collapse selected tags.
maxDisplayTags controls how many tags remain visible, and collapseTagsPopover (default true) decides whether collapsed tags are shown in a popover.

Please select
Please select
Hide source code

Searchable Options

Set filterable to make the drop-down searchable.
For the search input itself, pass inputValue for controlled mode; otherwise supply defaultInputValue for uncontrolled mode.

inputValue:
Please select
Please select
Hide source code

Adding Options

Set creatable to allow new options to be added (type string). filterable must also be enabled.

Please select
Please select
Hide source code

Virtual List

Enabling the virtualScroll property activates the virtual list, which can be turned on to improve performance when there is a large amount of option data.

Please Select
Hide source code

Custom Rendering of Options

Render options in a custom way via slots.

Please input
Hide source code

More Options

The Select component also inherits parts of Input, InputTag, and AutoComplete functionalities.

Disabled, Readonly, Loading & Clearable

Please input
Please input
Please input
Please input

Shape

Please input
Please input

Size

Please input
Please input
Please input

Slot

prefix
Please input
suffix

Composite

Please input

Status

Please input
Please input
Please input
Please input

Expose

Please input

Tag Render

Please input
Hide source code

API

SelectProps

AttributeTypeOptionalDefaultDescriptionVersion
modelValueanyTrueCurrent value (controlled), supports v-model.0.0.2
defaultValueanyTrueDefault value when uncontrolled.0.0.2
optionsstringTrueArray of options.0.0.2
placeholderstringTruePlaceholder text.0.0.2
disabledbooleanTruefalseDisable the whole selector.0.0.2
readonlybooleanTruefalseMake the selector read-only.0.0.2
clearablebooleanTruefalseShow a clear button.0.0.2
multiplebooleanTruefalse0.0.2
loadingbooleanTruefalseShow loading state.0.0.2
inputValuestring | nullTrueSearch input text (controlled), supports v-model.0.0.2
defaultInputValuestring | nullTrueDefault search input text when uncontrolled.0.0.2
filterablebooleanTruefalseEnable search within options.0.0.2
shouldShowPopover(value: string, optionsFiltered: (string | SelectOption | SelectGroupOption)[]) => booleanTrueFunction to determine whether to show the popover.0.0.2
filter(keyword: string, options: (string | SelectOption | SelectGroupOption)[]) => (string | SelectOption | SelectGroupOption)[]TrueFunction to filter options.0.0.2
creatablebooleanTruefalseAllow creating new options; requires filterable.0.0.2
collapseTagsbooleanTruefalseCollapse selected tags in multi-select mode.0.0.2
maxDisplayTagsnumberTrueMax number of visible tags when collapseTags is on.0.0.2
collapseTagsPopoverbooleanTruetrueShow collapsed tags in a popover when collapseTags is on.0.0.2
virtualScrollbooleanTruefalseWhether render options with virtual list.0.0.3
virtualListPropsOmit<VirtualListProps, 'list' | 'fixedHeight'> & RestAttrsTrueProperties of virtual list.0.0.3
tagPropsOmit<TagProps, 'size' | 'disabled' | 'closable'> & EmitEvent<TagEvents> & RestAttrsTrueProperties of tags.0.0.3
size'medium' | 'large' | 'small'True'medium'Size of the selector.0.0.2
shape'rect' | 'round'True'rect'Shape of the selector.0.0.3
borderRadiusNumberOrPercentage | NumberOrPercentage[]TrueBorder-radius value; higher priority than shape. Single value or 1-item array → all corners; 2-item array → [top-left & bottom-right, top-right & bottom-left]; 3-item array → [top-left, top-right & bottom-left, bottom-right]; 4-item array → clockwise order for all four corners.0.0.2
status'success' | 'warning' | 'error' | 'normal'True'normal'Form validation status.0.0.2
tagTheme'primary' | 'sakura' | 'success' | 'warning' | 'danger' | 'info'True'info'Deprecated theme properties for tags (color theme).0.0.2
tagVariant'primary' | 'plain' | 'outline'True'plain'Deprecated variant properties for tags (style variant).0.0.2
tagColorstringTrueDeprecated color properties for tags (custom color).0.0.2
popoverPropsOmit<PopoverProps, 'visible' | 'content'> & EmitEvent<PopoverEvents>TruePopover component properties when tags are collapsed.0.0.3
popoverPropsOmit<PopoverProps, 'visible' | 'content'> & EmitEvent<PopoverEvents>TruePopover component properties when tags are collapsed.0.2.0
optionsDestroyOnHidebooleanTruefalseWhether the dropdown options will be destroyed when hidden.0.0.3
pollSizeChangebooleanTruefalseEnables polling for component size changes. This also affects the property of the same name in data input components that are child components.0.1.0

SelectEvents

EventParameterDescriptionVersion
inputvalue: string, e: EventFired on search input.0.0.2
update:modelValuevalue: anyFired when modelValue changes.0.0.2
update:inputValuevalue: stringFired when inputValue changes.0.0.2
changevalue: anyFired when selection changes.0.0.2
changevalue: string, e: Event | undefinedFired when selection changes.0.0.2
clearvalue: anyFired when the clear button is clicked.0.0.2
blurFired when the selector loses focus.0.0.2
focusevent: FocusEventFired when the selector gains focus.0.0.2
selectvalue: any, option: string | SelectOption, e: MouseEventFired when an option is selected.0.0.2
tagClosevalue: any, e: MouseEventFired when a tag is closed.0.0.2
dropdownOpenCallback when the dropdown panel is opened.0.2.0
dropdownCloseCallback when the dropdown panel is closed.0.2.0

SelectSlots

SlotParameterDescriptionVersion
prefixPrefix content.0.0.2
suffixSuffix content.0.0.2
optionoption: string | SelectOptionCustom option content.0.0.2
group-labeloption: SelectGroupOptionCustom group-label content.0.0.2
tagvalue: any, label: string, index: number, disabled: boolean, readonly: booleanCustom tag content.0.0.3
labelvalue: any, label: string, disabled: boolean, readonly: booleanSelected content.0.0.3

SelectExpose

AttributeTypeOptionalDefaultDescriptionVersion
focus() => voidFalseFocus the selector.0.0.2
blur() => voidFalseBlur the selector.0.0.2
clear() => voidFalseClear the current input.0.0.2

Option, GroupOption

ts
export interface Option<T = any> {
	value: T
	label: string
}

export interface GroupOption<T = any> {
	children: (Option<T> | string)[]
	type: 'group'
}

OptionListOption, OptionListOption

ts
export interface OptionListOption<T = any> extends Option<T> {
	disabled?: boolean
	key?: string | number | symbol
}

export interface OptionListGroupOption extends GroupOption {
	label: string
	key: string | number | symbol
	children: (OptionListOption | string)[]
}

SelectOption, SelectGroupOption

ts
export interface SelectOption extends OptionListOption<any> {
}

export interface SelectGroupOption extends OptionListGroupOption {
	children: (SelectOption | string)[]
}

RestAttrs

ts
import type { StyleValue } from 'vue'

export type VueClassValue = string | Record<string, any> | VueClassValue[]
export type VueStyleValue = StyleValue

export type RestAttrs = {
	style?: VueStyleValue | null
	class?: VueClassValue | null
	[x: string]: any
}

EmitEvent

ts
export type EmitEvent<T extends Record<string, any>> = {
	[K in keyof T as `on${Capitalize<K & string>}`]?: (...args: T[K]) => void
}