Skip to main content
Version: 1.0.4

ITreeViewContextValue

@spartanfx/react v1.0.4


@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

PropertyTypeDescription
collapseAll() => voidCollapse all nodes in the tree
expandAll() => voidExpand all nodes in the tree
expandedIdsstring[]Array of currently expanded node IDs
getNodeById(id) => ITreeNode<T>Get a tree node by its ID
moveNode(movedId, targetParentId, index) => voidProgrammatically move a node to a new parent and index
nodeMapMap<string, ITreeNode<T>>Map of node ID to tree node for O(1) lookups
nodesITreeNode<T>[]Flat array of all tree nodes
selectedIdstringCurrently selected node ID, or null if none selected
setSelectedId(id) => voidFunction to programmatically set selected node
toggleExpanded(id) => voidToggle expansion state of a specific node