Tree

A hierarchical list component with nested items, expansion, and selection.

  • app
  • components
  • Button.vue
  • Card.vue
  • Tree.vue
  • package.json
  • README.md

Expanded: [ "app", "components" ]

Selected: null

Installation

Terminal
npx shadcn-vue@latest add https://raya-ui.com/registry/tree.json

Props

PropTypeDefaultDescription
itemsArray[]The hierarchical data to render.
modelValueanyundefinedThe currently selected item(s). Use v-model.
expandedstring[][]Keys of expanded items. Use v-model:expanded.
labelKeystring'label'Key to access the label in your data objects.
childrenKeystring'children'Key to access nested children in your data objects.
multiplebooleanfalseAllow selecting multiple items.
propagateSelectbooleantrueIf true, selection state propagates down to children (if multiple).

Emits

EventPayloadDescription
update:modelValueanyFired when selection changes.
update:expandedstring[]Fired when items are expanded or collapsed.
selectnodeFired when a node is selected.

Slots

SlotPropsDescription
#item{ item, expanded, selected }Custom content for each tree item.