TreeNode
| Type |
Name |
Description |
| string |
id |
|
| string |
label |
|
| string |
href? |
A leaf that is a link. |
| string |
icon? |
|
| TreeNode[] |
children? |
|
Tree
A nested list that opens and closes by branch: a file tree, a table of contents, a category menu. Built on native <details>, so it opens and closes without script and keeps working with the keyboard (Tab, Enter, Space), like any list of links. current is the id of the node to mark with aria-current (its branches open).
| Type |
Name |
Description |
| TreeNode[] |
nodes |
|
| string |
current? |
The id of the current node. |
| string |
label? |
What the tree is called for screen readers. |
| (node: TreeNode) => void |
onselect? |
Called when a node is chosen. |
<Tree label="Manual" current="panel" nodes={[{ id: "ui", label: "UI", children: [{ id: "panel", label: "Panel", href: "/panel" }] }]} />