Skip to content

TreeView

TreeView is a compound component for rendering hierarchical expandable/collapsible data with keyboard navigation and selection support.

Basic usage

Selected: —

Tailwind v4
vue
<script setup>
import { ref } from 'vue'
const selected = ref('')
</script>

<TreeView v-model="selected">
  <TreeViewItem value="docs" label="Documents" :default-expanded="true">
    <TreeViewItem value="resume" label="Resume.pdf" />
    <TreeViewItem value="cover" label="Cover Letter.docx" />
  </TreeViewItem>
  <TreeViewItem value="notes" label="notes.txt" />
</TreeView>

Multiple selection

Tailwind v4
vue
<TreeView v-model="selected" :multiple="true">
  <TreeViewItem value="a" label="Item A" />
  <TreeViewItem value="b" label="Item B" />
</TreeView>

Props — TreeView

PropTypeDefaultDescription
modelValuestring | string[]Selected item key(s)
multiplebooleanfalseAllow multiple selections

Props — TreeViewItem

PropTypeDefaultDescription
valuestringUnique key for this item (required)
labelstringDisplay label (required)
disabledbooleanfalseDisable selection for this item
defaultExpandedbooleanfalseStart expanded when children are present

Slots — TreeViewItem

SlotDescription
defaultNested TreeViewItem children
iconIcon shown before the label

Events — TreeView

EventPayloadDescription
update:modelValuestring | string[]Emitted when selection changes

Private — Jetpack Labs internal use only