For AI agents: the complete documentation index is available at https://ifhover.github.io/leaf-ui/v/0.6.0/en/llms.txt, the full documentation bundle is available at https://ifhover.github.io/leaf-ui/v/0.6.0/en/llms-full.txt, and this page is available as Markdown at https://ifhover.github.io/leaf-ui/v/0.6.0/en/components/tree.md.
Drag a handle to the upper, middle or lower part of a target row to place a node before, inside or after it. With the keyboard, Space picks up or drops, Up/Down chooses a target, Left/Right places before/after it, and Escape cancels. Update data with the new tree returned by onDrop.
Expand Projects to load children. Move nodes using their handles.
Update cacheKey to refresh lazy caches for the same node keys. Changing data or loadData also clears caches; keep their references stable across unrelated renders. Cancelled requests cannot overwrite the new data.
Documents
The root key stays stable. A new cache version discards old children and cancels pending requests.
Checking a parent checks enabled children; disabled nodes are unaffected. Partially checked children create a mixed parent. checkStrictly keeps checks independent. In multiple mode, clicking toggles selection; Shift selects a range of visible nodes.
Use up/down to move, right/left to expand/collapse, Home/End to jump, Enter to select and Space to check. Typing locates nodes. Search temporarily reveals matching paths; clearing it restores the original expansion.
Move a node in a custom data operation. This pure function returns a new tree without changing its input. It returns null for missing targets, self moves or moves into descendants. Tree already includes the new data in its onDrop callback.
import { moveTreeNode } from '@ifhover/leaf-ui';const next = moveTreeNode(data, 'design', 'team', 'inside');