ITreeViewContextValue
@spartanfx/react / ITreeViewContextValue
Interface: ITreeViewContextValue<T>
Context value provided by TreeView for external control and queries.
Access via useTreeViewContext hook.
Type Parameters
T
T = any
Properties
| Property | Type | Description |
|---|---|---|
collapseAll | () => void | Collapse all nodes in the tree |
expandAll | () => void | Expand all nodes in the tree |
expandedIds | string[] | Array of currently expanded node IDs |
getNodeById | (id) => ITreeNode<T> | Get a tree node by its ID |
moveNode | (movedId, targetParentId, index) => void | Programmatically move a node to a new parent and index |
nodeMap | Map<string, ITreeNode<T>> | Map of node ID to tree node for O(1) lookups |
nodes | ITreeNode<T>[] | Flat array of all tree nodes |
selectedId | string | Currently selected node ID, or null if none selected |
setSelectedId | (id) => void | Function to programmatically set selected node |
toggleExpanded | (id) => void | Toggle expansion state of a specific node |