ComponentsData Display
Tree View
Hierarchical tree structure for displaying nested data
The Tree View component displays hierarchical data in an expandable tree structure, perfect for file explorers, organizational charts, and nested navigation.
Basic Usage
File Tree
Nested Structure
Deep Nesting
Schema
interface TreeNode {
id: string; // Unique node identifier
label: string; // Node label text
icon?: string; // Icon name ('folder' or 'file')
children?: TreeNode[]; // Child nodes
data?: any; // Additional node data
}
interface TreeViewSchema {
type: 'tree-view';
// Data
data?: TreeNode[]; // Tree data (alias for nodes)
nodes?: TreeNode[]; // Tree nodes
title?: string; // Tree title
// Selection
defaultExpandedIds?: string[]; // Default expanded node IDs
defaultSelectedIds?: string[]; // Default selected node IDs
expandedIds?: string[]; // Controlled expanded node IDs
selectedIds?: string[]; // Controlled selected node IDs
multiSelect?: boolean; // Enable multi-selection (default: false)
// Appearance
showLines?: boolean; // Show connecting lines (default: true)
// Events
onSelectChange?: (selectedIds: string[]) => void; // Selection change handler
onExpandChange?: (expandedIds: string[]) => void; // Expand change handler
onNodeClick?: (node: TreeNode) => void; // Node click handler
// Styling
className?: string; // Tailwind CSS classes
// Base properties
id?: string;
visible?: boolean | string;
testId?: string;
}