TreeView

Display hierarchical data with expandable/collapsible nodes and selection support.

tsx
import { TreeView } from '@xdev-asia/x-ui-react';

Example

src
components
Button.tsx
Card.tsx
hooks
useTheme.ts
index.ts
package.json
README.md

Features

  • ✅ Expand/collapse nodes
  • ✅ Single or multiple selection
  • ✅ Checkbox mode
  • ✅ Custom node icons
  • ✅ Keyboard navigation
  • ✅ Controlled expand/select state

Props

  • nodes - TreeNode[] data structure
  • selectionMode - 'none' | 'single' | 'multiple'
  • showCheckbox - Show selection checkboxes
  • expandAll - Expand all nodes initially
  • expandedIds - Controlled expanded nodes
  • selectedIds - Controlled selected nodes
  • size - 'sm' | 'md' | 'lg'