Skip to content
Lower pricing Individual licenses are now $49/year for Studio, $25 for Core — See pricing →

TreeView Diagram

Last updated:

Mermaid Studio provides language support for TreeView diagrams inside IntelliJ IDEA and other JetBrains IDEs. TreeView diagrams display hierarchical data as an indented tree, similar to a file browser: each line is a node, and indentation alone determines parent-child relationships. TreeView is a beta diagram type and requires Mermaid.js 11.14.0 or later.

Syntax highlighting integrates directly with IntelliJ’s color scheme system, so diagram colors always match your editor theme.

TreeView syntax highlighting in Armada Dark theme

The summary below shows the IDE support Mermaid Studio ships for TreeView diagrams, grouped by capability.

IDE feature supportSelect a feature for its description.
Editing
Code Intelligence
Validation
Appearance
treeView-beta
title Project Structure
"root"
"src"
"main"
"index.ts"
"app.ts"
"utils.ts"
"test"
"app.test.ts"
"utils.test.ts"
"docs"
"README.md"
"CONTRIBUTING.md"
"package.json"
"tsconfig.json"

Key elements:

  • Start with treeView-beta
  • Optionally include title, accTitle, and accDescr metadata before any node rows
  • Node names may be quoted (double or single quotes) or, on Mermaid.js 11.16.0+, bare (index.ts)
  • Indentation determines hierarchy - nested nodes are children of the less-indented node above
  • On Mermaid.js 11.16.0+, box-drawing guides (├──, , └──) pasted from tools like tree are accepted in place of plain indentation
  • On Mermaid.js 11.16.0+, a node name may be followed by annotations: :::class applies a CSS class, icon(...) attaches an icon (see Icons), and ## text adds a description

On Mermaid.js 11.16.0+, an icon() annotation after a node name attaches an icon to the node. The built-in folder and file icons are referenced by bare name, and any icon from an enabled icon set is referenced as pack:name. The example below mixes both forms:

treeView-beta
"project"
"src" icon(folder)
"index.ts" icon(logos:typescript-icon) ## entry point
"README.md" icon(file)

An unprefixed name that is not a built-in resolves through the config.treeView.defaultIconPack frontmatter key, so with defaultIconPack: logos you can write icon(typescript-icon). Writing icon(none) or an empty icon() suppresses the icon. The defaultIconPack, filenameIcons, and extensionIcons config keys get completion and validation in the frontmatter block; see the Mermaid.js TreeView documentation for what each key does.

Completion inside the parentheses offers the built-ins and every icon from your enabled icon sets, each with a preview, shown here filtered to the logos pack:

TreeView diagram in the editor with the completion popup open inside icon(logos:), listing logos-pack icons with image previews

Typing a pack prefix such as logos: filters the list to that pack, and the popup opens automatically when you type ( or :. When a defaultIconPack is set, that pack’s icons also complete as bare names. A reference that resolves to no built-in, default-pack, or enabled icon-set icon is flagged with a weak warning, since it would render no icon.

Which icon sets are enabled, and how to add your own, is covered in Icon Sets.

For complete syntax details, see the Mermaid.js TreeView documentation.