- Organization Components
- File Trees
Organization Components
File Trees
Show a project structure with expandable folders and keyboard navigation.
Use Tree to explain where files belong. It displays a structure; it does not read
your filesystem or turn file names into links.
Example
docs
layout.json
quickstart.mdx
guides
installation.mdx
publishing.mdx
<Tree>
<Tree.Folder name="docs" defaultOpen>
<Tree.File name="layout.json" />
<Tree.File name="quickstart.mdx" />
<Tree.Folder name="guides" defaultOpen>
<Tree.File name="installation.mdx" />
<Tree.File name="publishing.mdx" />
</Tree.Folder>
</Tree.Folder>
</Tree>
Click a folder to open or close it. With the tree focused, use arrow keys to move between items and expand or collapse folders. Home and End move to the first and last visible items. Type a file or folder name to move focus to a matching item.
Properties
| Component | Property | Default | Purpose |
|---|---|---|---|
Tree | children | Required | Tree.Folder and Tree.File entries. |
Tree | className | None | Optional styling classes. |
Tree.Folder | name | Required | Folder label. |
Tree.Folder | defaultOpen | false | Start with the folder expanded. |
Tree.Folder | openable | true | Allow expansion when children exist. Set to false for a folder label with no expandable content. |
Tree.Folder | children | None | Nested folders and files. |
Tree.File | name | Required | File label. |
