Skip to content

Tree

Tree component for displaying hierarchical data such as file directories, organization structures, and category navigation.


Basic Usage

vue

<TTree :data="data" v-model:expanded-keys="expandedKeys" />

Default Expand All

vue

<TTree :data="data" default-expand-all />

With Checkbox

vue

<TTree :data="data" show-checkbox v-model:checked-keys="checkedKeys" />

Accordion Mode

vue

<TTree :data="data" accordion />

Variant

Set variant="flush" to remove outer border and border-radius, keeping only item separators. Ideal for embedding in cards or sidebars.

vue

<TTree :data="data" variant="flush" />

Check Mode

The check-mode prop controls checkbox linkage behavior:

  • cascade (default): Full parent-child linkage. Checking a parent selects all children; checking any child marks the parent as indeterminate.
  • parent-link: Children auto-check the parent, but parent toggling doesn't affect children.
  • independent: Each node is independent with no linkage.
vue

<TTree :data="data" show-checkbox check-mode="cascade" />
<TTree :data="data" show-checkbox check-mode="parent-link" />
<TTree :data="data" show-checkbox check-mode="independent" />

API

Props

PropTypeDefaultDescription
dataTreeNode[][]Tree data
node-keystring'id'Node unique key field
childrenstring'children'Children field name
label-keystring'label'Label field name
default-expand-allbooleanfalseExpand all parent nodes
expanded-keys(string | number)[][]Expanded node keys
checked-keys(string | number)[][]Checked node keys
show-checkboxbooleanfalseShow checkbox
check-mode'independent' | 'parent-link' | 'cascade''cascade'Checkbox linkage mode
variant'default' | 'flush''default'Visual variant
accordionbooleanfalseAccordion mode
indentnumber24Indent per level (px)

TreeNode

FieldTypeDescription
idstring | numberUnique identifier
labelstringDisplay text
childrenTreeNode[]Child nodes
disabledbooleanDisabled state
iconComponentNode icon

Emits

EventParametersDescription
update:expanded-keyskeysExpanded keys changed
update:checked-keyskeysChecked keys changed
node-clicknode, eventNode clicked
node-expandnodeNode expanded
node-collapsenodeNode collapsed