Skip to content

Tree

Tree control for displaying hierarchical data, with expand/collapse support.

Basic Usage

Pass tree data with data. Each node can have label and children.

node_modules
vue
<ATree :data="[
  {
    label: 'Project',
    children: [
      {
        label: 'src',
        children: [
          { label: 'index.ts' },
          { label: 'App.vue' }
        ]
      },
      { label: 'package.json' }
    ]
  }
]" />

Node Click

node-click event returns the clicked node data and path.

Documents
Music
vue
<ATree :data="data" @node-click="(node) => console.log(node.label)" />

API

Props

NameTypeDefaultDescription
dataTreeNodeData[]Tree data
nodeKeystring'id'Node unique key field

Events

NameParametersDescription
nodeClick(node, path)Triggered on node click

TreeNodeData

PropertyTypeDescription
labelstringNode display text
childrenTreeNodeData[]Child nodes (optional)

Interaction

  • Arrow icon rotates to indicate expand/collapse
  • Nodes with children show expand arrow
  • Nested level indentation
  • Hover highlight
  • Full ARIA tree role

MIT License