TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/shuding/nextra/llms.txt
Use this file to discover all available pages before exploring further.
FileTree component renders an interactive, tree-structured visualization of a file system layout. It is composed of three parts exported from the same FileTree object: the root FileTree wrapper, FileTree.Folder for directories, and FileTree.File for individual files. Folders are collapsible — clicking them toggles their open state — and both files and folders can be highlighted as “active” to draw attention to a specific item.
Import
Props
<FileTree>
The root container accepts all standard HTML <ul> attributes.
| Prop | Type | Description |
|---|---|---|
children | ReactNode | FileTree.Folder and FileTree.File elements. |
className | string | Additional CSS class names for the root list element. |
<FileTree.Folder>
| Prop | Type | Default | Description |
|---|---|---|---|
name | ReactNode | — | Required. The folder name displayed in the tree. |
defaultOpen | boolean | false | When true, the folder is expanded on initial render. |
open | boolean | — | Controlled open state. When provided, the folder cannot be toggled by the user. |
active | boolean | — | Highlights the folder name with the primary theme colour. |
children | ReactNode | — | Nested FileTree.Folder and FileTree.File elements. |
<FileTree.File>
| Prop | Type | Default | Description |
|---|---|---|---|
name | ReactNode | — | Required. The file name displayed in the tree. |
active | boolean | — | Highlights the file name with the primary theme colour. |
Usage
Basic File Tree
Nested Folders
Folders can be nested to any depth. By default all folders are collapsed; usedefaultOpen on the folders you want pre-expanded.
Highlighting Active Files
Use theactive prop on any <FileTree.File> or <FileTree.Folder> to emphasise a particular item — useful when describing changes to a specific file in a step-by-step guide.
Controlled Open State
Pass an explicitopen prop to lock a folder in a fixed expanded or collapsed state regardless of user interaction. This is useful for diagrams where you want to illustrate a specific layout without allowing the tree to be modified.
A folder with an explicit
open prop renders without a click handler — the toggle button is disabled — so the user cannot change its state.