useSplit
Hook for reading a split node and programmatically setting its children's sizes.
useSplit gives you direct access to a SplitNode and the ability to set its children's sizes programmatically. It is the split-level companion to usePanel.
Signature
The component re-renders only when the split identified by splitId changes — not on unrelated mutations elsewhere in the tree.
split
The current split node, or null if it has been removed from the tree. Always check for null before reading split fields.
setSizes
Sets the sizes of the split's children. Sizes are percentages and must sum to 100. The array length must match the number of children in the split — if it doesn't, the call is silently ignored.
Min/max constraints defined in the tab registry are still enforced after the call.
When to use useSplit vs usePanel
useSplit | usePanel | |
|---|---|---|
| Scope | A SplitNode (container) | A PanelNode (leaf) |
| Primary use | Programmatic resize | Tab management, collapse, maximize, split |
| Key action | setSizes | addTab, split, toggleCollapse, toggleMaximize |
Use useSplit when you need to control sizes from outside the drag handle — for example, a "reset layout" button or a preset that snaps panels to predefined ratios.