Duct UI

TreeView Component

Collapsible tree view for hierarchical data with expand/collapse functionality

Basic Usage

Simple Tree

โ–ผ๐ŸพAnimals
โ€ข๐Ÿ•Dog
โ€ข๐ŸฑCat
โ€ข๐ŸฆBird
โ–ถ๐ŸŽFruits
โ€ข๐ŸŽจColors

Click the arrows to expand/collapse nodes. Click labels to select items.

Icon-Only Expand

โ–ถ๐ŸพAnimals
โ–ถ๐ŸŽFruits
โ€ข๐ŸŽจColors

Only arrow icons expand/collapse nodes. Clicking labels fires the clicked event.

File System Example

Interactive File Tree with Programmatic Control

All Nodes:
src/:
โ–ผ๐Ÿ“src/
โ–ถ๐Ÿ“components/
โ–ถ๐Ÿ“utils/
โ€ข๐Ÿ“œindex.ts
โ–ผ๐Ÿ“docs/
โ€ข๐Ÿ“„README.md
โ€ข๐Ÿ“„API.md
โ€ข๐Ÿ“ฆpackage.json
โ€ขโš™๏ธtsconfig.json

A realistic file system tree with programmatic controls. Try the "Load Project" buttons to switch between different project structures, or use the other buttons to control expand/collapse behavior.

Event Log

Tree Events

No events yet...

TreeView Features:

  • Collapsible Nodes - Click arrows to expand/collapse
  • Label Click Expand - Optional expand on label click (default: true)
  • Path-based Events - Events include full path to clicked node
  • Initial State - Set initially expanded nodes
  • Custom Styling - Customize labels, icons, and indentation
  • Programmatic Control - expandNode(), collapseNode(), toggleNode()
  • Bulk Operations - expandAll(), collapseAll()
  • Data Refresh - setData() to load new tree structures
  • Rich Data Support - Generic data type for custom metadata
  • Event Handling - on:expanded, on:collapsed, on:clicked