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 — inline nodes, or bind the tree with `bind` (read first)
nodes?: TreeNode[]; // Tree nodes (the one inline spelling)
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
onNodeClick?: (node: TreeNode) => void; // Node click handler
// Styling
className?: string; // Tailwind CSS classes
// Base properties
id?: string;
visible?: boolean | string | { dialect?: string; source: string };
testId?: string;
}Retired:
data(objectui#6951, ADR-0049 enforce-or-remove).datawas a second spelling of the tree's one inline-nodes slot — the renderer read it only as the last limb ofbind || nodes || data— and it is no longer part ofTreeViewSchemaon either face. Atree-viewnode that authorsdatanow fails validation with:RETIRED (objectui#6951) —
datais no longer part of TreeViewSchema; writenodes(or bind the tree withbind). …Rename the key to
nodes; the array is unchanged.bindis unchanged and is still read first, so abind-only tree-view stays a legal document, andnodesstays optional (no presence rule was added).TreeNode.data— the per-node payload — is a different member and is untouched.