Tree
Hierarchical file and folder structures.
Use Tree (or its alias FileTree) to display file systems and project
directories. Tree.Folder and Tree.File compose explicitly, or write a
nested Markdown list inside the tree for quick static structures.
- layout.tsx
- page.tsx
- global.css
- utils.ts
- db.ts
- package.json
- tsconfig.json
Markdown list syntax#
Leave a blank line after the opening tag. A trailing slash (or nested items) marks a folder; folders with nested items expand by default.
- index.mdx
- configuration.mdx
- docs.config.ts
Highlight the active path#
- layout.tsx
- page.tsx
- package.json
Set --tree-highlight on the Tree style to override the tint.
Folders support arrow-key navigation: up/down moves, right expands,
left collapses, * expands siblings, typing jumps to a name.
Properties#
Tree / FileTree#
| Name | Type | Description |
|---|---|---|
| children | ReactNode |
|
Tree.Folder#
| Name | Type | Description |
|---|---|---|
| namerequired | string | Folder name shown in the tree. |
| defaultOpen | boolean | Whether the folder expands by default. Default: false |
| openable | boolean | Set to false for non-interactive folders. Default: true |
| highlight | boolean | Tint the folder as the active path. Default: false |
Tree.File#
| Name | Type | Description |
|---|---|---|
| namerequired | string | File name shown in the tree. |
| highlight | boolean | Tint the file as the active item. Default: false |