Skip to content

useTableTreeState

@astryxdesign/core v0.7.1 · useTableTreeState

Usage ​

State management companion for useTableTreeData. Owns the expanded set (controlled or uncontrolled) and flattens nested data into the visible row array; collapsed subtrees are unmounted, not hidden, so the table body contains exactly the visible rows. Returns expandAll / collapseAll helpers, the aggregate isAllExpanded state (true/false/indeterminate) for a header expand-all control, and a ready-to-use plugin for the tree. Note: because collapsed rows unmount, local component state inside collapsed subtrees is lost on collapse; lift state that must survive.

ts
import { useTableTreeState } from '@astryx-vue/core/Table'

Examples ​

useTableTreeState — Tree Table

Name
Owner
Platform
Ada
API
Grace
Design
Noah

Nested rows are flattened into the visible rows, and the expanded set lives in the hook. The header control expands every branch, and a row click expands a node that has children.