Skip to content

TreeSelect

Supports extreme virtual scrolling retrieval.

When data is massive or follows a clear hierarchical structure, TreeSelect provides an efficient selection solution within a compact space.

Basic Usage

Standard single-selection mode. By default, only leaf nodes can be selected; clicking parent nodes automatically expands or collapses them.

Value:

Basic Selection

Disabled State

You can disable the entire component or specific nodes (like "QA Team" in this demo) via the disabled field in your data.

Disabled State

Clearable

Setting the clearable property displays a clear button on hover.

Frontend Team

Value: 1-1-1

Clearable

Multiple Selection and Tag Folding

Use multiple to enable multi-selection. Using collapse-tags is recommended for saving space.

Value: []

Multi-Selection

Select Any Level

Enabling check-strictly allows users to select any node regardless of whether it is a leaf.

R&D Center

Value: 1-1

Any Level Selection

Checkbox Mode

Use show-checkbox to provide a clearer visual selection state in multi-selection scenarios.

Value: []

Checkbox Mode

Filterable

With filterable enabled, users can type keywords directly into the input to filter nodes.

Search Filter

Lazy Loading

Set lazy and provide a load function to asynchronously load child nodes, which is very useful for large organization charts.

Lazy Loading

Custom Content

Use the #default slot to fully customize how tree nodes appear in the menu.

Custom Slot

Virtual Scrolling (10,000+ Nodes)

Built-in proprietary virtual scrolling. To optimize performance, virtual scrolling is disabled by default. For large datasets (recommended for 500+ items), set virtual to true.

Basic Search Demo

Value Count: 0

Massive Data Search

Checkbox Mode

Even with massive data, cascaded checkbox selections remain smooth.

Checked Count: 0

Massive Data Checklist

Usage in Nuxt

TreeSelect is fully compatible with Nuxt 3/4. Thanks to the Auto Import feature, you can use it directly in templates.

Nuxt Usage

SSR Considerations:

  • ✅ Initial tree structure rendering (including expand/collapse state) is supported.
  • ✅ Selected Tokens render correctly on the server.
  • ✅ Virtual scrolling displays initial nodes on first load.
  • ✅ Lazy load initial data supports SSR.
  • 💡 Filter functionality and async loading activate after client-side hydration.

SSR Safety

TreeSelect utilizes Vue 3.5's native useId mechanism, ensuring node IDs and ARIA attributes stay identical between server and client even in complex recursive structures, avoiding common hydration errors.

API

TreeSelect Attributes

NameDescriptionTypeDefault
model-value / v-modelBinding valuestring | number | (string | number)[]
dataDisplay dataTreeOption[][]
propsConfiguration optionsobject
node-keyUnique identifier attribute for each node; should be unique across the treestring'value'
multipleWhether multiple selection is allowedbooleanfalse
clearableWhether to allow clearing of the selectionbooleanfalse
disabledWhether disabledbooleanfalse
sizeInput size'large' | 'default' | 'small''default'
placeholderPlaceholder textstring'Please select'
empty-textText shown when there is no datastring'No Data'
filterableWhether list is searchablebooleanfalse
filter-node-methodCustom filter method(value: string, data: TreeOption, node: any) => boolean
collapse-tagsWhether to fold tags in multi-selectbooleanfalse
collapse-tags-tooltipWhether to show a tooltip for folded tags (displaying count)booleanfalse
max-collapse-tagsMax tags displayed before foldingnumber1
check-strictlyWhether to decouple parent and child checkbox statusesbooleanfalse
show-checkboxWhether to show checkboxes before nodesbooleanfalse
default-expand-allWhether to expand all nodes by defaultbooleanfalse
default-expanded-keysInitial keys for expanded nodesTreeKey[][]
accordionWhether to expand only one peer node at a timebooleanfalse
indentHorizontal indent between levelsnumber16
check-on-click-nodeWhether to check checkbox on node clickbooleanfalse
expand-on-click-nodeWhether to expand/collapse on node clickbooleantrue
lazyWhether to enable lazy loadingbooleanfalse
loadFunction for loading subtree dataFunction
virtualWhether to enable virtual scrollingbooleanfalse
heightMax height of the dropdown menustring | number274
item-sizeHeight of each item for virtual scrollingnumber34
teleportedWhether to mount the dropdown to bodybooleantrue
popper-classCustom class for popperstring
statusValidation status for the input'success' | 'warning' | 'error' | ''

TreeSelect Props (Config Options)

NameDescriptionType
labelSpecifies the node label propertystring
valueSpecifies the selection value propertystring
childrenSpecifies the child nodes propertystring
disabledSpecifies the node disabled status propertystring
isLeafSpecifies if a node is a leaf (only for lazy load)string

TreeSelect Events

NameDescriptionParameters
changeTriggers when the selection changes(value: any) => void
visible-changeTriggers when the dropdown visibility changes(visible: boolean) => void
clearTriggers when the clear button is clicked
node-clickTriggers on node click(data: TreeOption, node: TreeNode, e: MouseEvent) => void
check-changeTriggers when a checkbox state changes(data: TreeOption, checked: boolean, indeterminate: boolean) => void
checkTriggers on checkbox click(data: TreeOption, info: any) => void

TreeSelect Slots

NameDescriptionParameters
defaultCustom content for tree nodes{ node: TreeNode, data: TreeOption }
prefixCustom input prefix content
emptyContent for empty/no-matching-data states

Theme Variables

Variable NameDescriptionDefault
--yh-tree-select-node-hover-bgNode background color on hovervar(--yh-fill-color-light)
--yh-tree-select-node-selected-colorText color for selected nodesvar(--yh-color-primary)

Released under the MIT License.