Tree

A hierarchy the reader can expand, select, check and drag, with a virtual list for the large ones.

Basic

Pass treeData and add checkable for checkboxes, with disabled or disableCheckbox on nodes people cannot change, like a locked folder.

Controlled

Keep expandedKeys, checkedKeys and selectedKeys in your own state, updated from onExpand, onCheck and onSelect.

Line

Add showLine to draw guide lines that connect each node to its parent.

Leaf icon

Pass showLine an object with showLeafIcon to put an icon at the end of each leaf's guide line, like a file icon.

Icons

Add showIcon and give each node an icon, like a folder for branches and a file for leaves.

Directory

Use Tree.DirectoryTree for a file browser that selects the whole row and shows folder and file icons, with multiple for several files.

Draggable

Add draggable and handle onDrop to move nodes, dropping one onto a folder to nest it or between rows to reorder.

Load on expand

Pass loadData to fetch a folder's children the first time it opens, with a spinner while they load.
Filter the tree from an Input, highlight the matching text and open the folders that contain a match with expandedKeys.

Virtual scroll

Set height to render only the visible rows, so a tree of a thousand nodes scrolls inside a fixed box.

Block node

Add blockNode so each row's highlight and click area fill the full width of the tree.

Check strictly

Set checkStrictly so checking a folder leaves its files alone, and each node is checked on its own.

Expand and collapse all

Set expandedKeys from two buttons to open every folder at once or close them all.

In context

The component inside real screens, with the components it usually sits beside.

Project files

A project files card with a directory tree where you add a folder, rename a row in place and delete one after a confirm.

API Reference

Tree
Tree's props. Rows marked antuikit in the Version column are added by the kit.
Tree.DirectoryTree
Tree.DirectoryTree's props, on top of Tree's. Rows marked antuikit in the Version column are added by the kit.
TreeNode
The fields of an entry in treeData.