merIDK / Diagram types / File tree diagram
Mermaid file tree diagram: example and syntax
Tree view draws a folder structure from the same text the tree command prints. It suits READMEs and docs that explain how a project is laid out.
Open this example in the editor
Example code
treeView-beta
├── src/
│ ├── app.js
│ └── templates.js
├── index.html
├── style.css
└── README.md
Result
treeView-beta ├── src/ │ ├── app.js │ └── templates.js ├── index.html ├── style.css └── README.md
Syntax quick reference
- Paste
treeoutput undertreeView-beta. - Branches use
├──and└──; deeper levels add│for each level. - End folder names with
/.
How to use it
- Open the example in the editor, or paste your own Mermaid code.
- Edit the code on the left. The preview updates as you type, and errors point to the line.
- Export SVG or PNG, copy a Markdown block for GitHub or Notion, or copy a share link.