Skip to content

Select

Use drop-down menus to display and select content from many options.

Basic Usage

Standard single select for a wide variety of scenarios.

Basic Usage

Disabled Option

Set the disabled field on an option item to make that option unavailable.

Disabled Option

Disabled State

Use disabled to disable the entire component.

Option 1
Disabled State

Clearable Single Select

Set clearable to allow the current value to be cleared.

Option 1
Clearable

Multiple Select

Set multiple to enable multiple selection. In this mode, v-model becomes an array.

Multiple Select

Collapse Tags

In multiple mode, use collapse-tags to reduce the visible tag count.

Option 1Option 2 +1
Collapse Tags

Filterable

Set filterable to enable keyword filtering inside the input.

Filterable

Use remote together with remote-method to fetch options asynchronously.

Remote Search

Allow Create

Set allow-create to let users create temporary options from the current input. This is intended to be used together with filterable.

Allow Create

Virtual Scroll

For large option sets, set virtual-scroll to improve rendering performance.

Virtual Scroll

Full Virtual Scroll Configuration

Use item-height and height to control the virtual list row height and viewport height.

  • item-height: height of each option row, default 34
  • height: dropdown viewport height, default 274
Full Virtual Scroll Configuration

Different Sizes

Use size to switch between large, default, and small.

Different Sizes

Use in Nuxt

YhSelect can be used directly in Nuxt after registering the YH-UI module. The selected text and option data render normally during SSR, while popup positioning, remote callbacks, and imperative focus helpers continue on the client after hydration.

Use in Nuxt

API

Props

NameDescriptionTypeDefault
model-value / v-modelBound valueYhSelectValue | YhSelectValue[]undefined
optionsOption data rendered by the componentYhSelectOption[][]
placeholderPlaceholder textstring''
disabledWhether the component is disabledbooleanfalse
clearableWhether the current value can be clearedbooleanfalse
sizeInput size'large' | 'default' | 'small''default'
multipleWhether multiple selection is enabledbooleanfalse
multiple-limitMaximum selected item count in multiple mode, 0 means unlimitednumber0
filterableWhether keyword filtering is enabledbooleanfalse
filter-methodCustom local filter method(query: string) => voidundefined
remoteWhether remote filtering is enabledbooleanfalse
remote-methodRemote search callback(query: string) => voidundefined
loadingWhether the loading state is shownbooleanfalse
loading-textCustom loading text. Falls back to locale text when emptystring''
no-match-textCustom empty text shown for no matching results. Falls back to locale text when emptystring''
no-data-textCustom empty text shown when there is no option data. Falls back to locale text when emptystring''
allow-createWhether users can create options from the current querybooleanfalse
collapse-tagsWhether selected tags are collapsed in multiple modebooleanfalse
collapse-tags-tooltipWhether collapsed tags show a tooltip summarybooleanfalse
max-collapse-tagsMaximum visible tag count when collapse-tags is enablednumber1
popper-classCustom dropdown class namestringundefined
teleportedWhether the dropdown is teleported to bodybooleantrue
fit-input-widthWhether the dropdown width follows the input widthbooleantrue
tag-typeTag type used in multiple mode'success' | 'info' | 'warning' | 'danger' | ''''
virtual-scrollWhether virtual scrolling is enabledbooleanfalse
item-heightVirtual list row heightnumber34
heightVirtual list viewport heightnumber274
validate-eventWhether form validation is triggered on change and blurbooleantrue
value-keyProperty name used as the option value keystring'value'
label-keyProperty name used as the option label keystring'label'
theme-overridesComponent-level theme overridesComponentThemeVarsundefined

Types

Select Option

NameDescriptionTypeRequired
valueOption valuestring | number | booleanYes
labelOption labelstringYes
disabledWhether the option is disabledbooleanNo

Events

NameDescriptionParameters
changeTriggered when the selected value changes(value: YhSelectValue | YhSelectValue[] | undefined) => void
focusTriggered when the input gains focus(event: FocusEvent) => void
blurTriggered when the input loses focus(event: FocusEvent) => void
clearTriggered when the clear icon is clicked() => void
visible-changeTriggered when the dropdown visibility changes(visible: boolean) => void
remove-tagTriggered when a selected tag is removed in multiple mode(value: YhSelectValue) => void

Slots

NameDescriptionParameters
defaultCustom YhOption nodes rendered instead of the options prop-
prefixContent rendered before the input area-
emptyContent rendered when there is no available option-
optionCustom option content when using the options prop{ option: YhSelectOption }
tagCustom tag content in multiple mode{ value: YhSelectValue }

Expose

NameDescriptionType
focusFocuses the input() => void
blurBlurs the input() => void
inputRefRef to the internal input elementRef<HTMLInputElement | undefined>

Option Props

NameDescriptionTypeDefault
valueOption valueYhSelectValueRequired
labelOption labelstringundefined
disabledWhether the option is disabledbooleanfalse

Option Slots

NameDescriptionParameters
defaultCustom option content-

Theme Variables

YhSelect supports themeOverrides. The component test suite verifies component-scoped override output such as themeOverrides.borderColor, which emits --yh-select-border-color. The visual styles of the input, tags, and dropdown still primarily inherit shared global tokens such as --yh-border-color, --yh-fill-color, and --yh-text-color-*.

VariableDescriptionDefault
--yh-select-border-colorBorder color emitted by themeOverrides.borderColorundefined

Type Exports

NameDescription
YhSelectPropsSelect component props type
YhSelectEmitsSelect component emits type
YhSelectSlotsSelect component slots type
YhSelectExposeSelect component expose type
YhSelectOptionOption data type
YhSelectValueSelected value type
YhSelectSizeSize union type
YhSelectTagTypeTag type union
YhOptionPropsOption component props type
YhOptionSlotsOption component slots type
YhSelectInstanceSelect component instance type
YhOptionInstanceOption component instance type

Released under the MIT License.