Skip to content

TreeSelect

Tree-structure selection supporting parent-child cascaded multiple selection.

Single Select

Single select

Click a node to select it and close the dropdown; children can be expanded/collapsed.

Multiple Select (parent-child linkage)

Multiple

In multiple mode, selecting a parent cascades the selection to all children; clicking again cancels. Parent nodes show an "all / half" selected state.

Check Strategy (check-strategy)

check-strategy controls which nodes enter value in multiple mode: all (default) keeps both parents and children; parent keeps only parent nodes (a parent represents its fully-checked children); child keeps only leaf nodes. All three strategies share the same cascaded checking logic — only the emitted value differs:

Check strategy (all / parent / child)

all: value =

parent: value =

child: value =

After checking "Frontend", the three strategies emit: all["fe","framework","vue","react","css"], parent["fe"], child["vue","react","css"] (order follows the demo data's declaration order of "Framework" children). Under parent, checking leaves one by one converges the value to the parent once all its children are checked.

Preset Value

Preset value

Controlled Expand (expanded)

expanded is a JSON array declaring the set of node values to expand (a controlled channel): externally changing the property immediately reflects in the dropdown tree. Below, "Frontend → Framework" is pre-expanded, and buttons drive it externally:

Controlled expand (expanded)

Expand allCollapse all

Presetting expanded='["fe","framework"]' expands "Frontend" and "Framework" the first time the dropdown opens; clicking "Expand all" externally writes expanded='["fe","framework","be"]', and "Collapse all" writes '[]', re-rendering immediately when the dropdown opens.

Large Data (Virtual Scroll)

Ten-thousand-node virtual scroll

Expand allCollapse all

Setting virtual enables windowed rendering (with height for the viewport and item-height for the row height): the dropdown reuses oas-virtual-list to render only the visible window, so 10,100 nodes (100 departments × 100 members) scroll smoothly; ↑/↓ move the highlight, Enter toggles a check, →/← expand/collapse, and aria-activedescendant stays valid across window re-renders. Data is injected via the options property channel, the expanded set is controlled by the expanded attribute, and "Expand all" writes the full node set externally.

Disabled

Disabled

Empty State

No data

Events

Change events

Listen to oas-change; detail.value is a string for single select and an array for multiple:

API

Attributes

AttributeDescriptionTypeDefault
check-strategyMultiple-select check strategy: all (default) keeps both parents and children in the value; parent keeps only parent nodes (a parent represents its fully-checked children); child keeps only leaf nodesstringall
disabledDisabledboolean
expandedSet of expanded node values (JSON array, controlled)string[]
heightVirtual-scroll viewport height (px); works with virtualstring288
item-heightFixed row height for virtual scroll (px)string36
multipleMultiple select + parent-child cascadeboolean
optionsTree options, JSON array, supports children / disabledTreeOption[] | string[]
placeholderPlaceholder text
valueSelected value (JSON array in multiple mode)string[]
virtualEnable virtual scroll: the dropdown renders only the visible window for large data (reuses oas-virtual-list), keeping keyboard/ARIA intactboolean

Events

EventDescription
oas-changeSelection change, detail: { value }

Released under the MIT OR Apache-2.0 License.