All diagram types Open editor

merIDK / Diagram types / Treemap

Mermaid treemap: example and syntax

Treemaps show hierarchical data as nested rectangles, each sized by its value. Use them for disk usage, budgets and code size by module.

Open this example in the editor

Example code

treemap-beta
"Frontend"
    "React": 40
    "CSS": 15
"Backend"
    "API": 30
    "Workers": 10
"Ops"
    "CI": 5

Result

treemap-beta
"Frontend"
    "React": 40
    "CSS": 15
"Backend"
    "API": 30
    "Workers": 10
"Ops"
    "CI": 5

Syntax quick reference

How to use it

  1. Open the example in the editor, or paste your own Mermaid code.
  2. Edit the code on the left. The preview updates as you type, and errors point to the line.
  3. Export SVG or PNG, copy a Markdown block for GitHub or Notion, or copy a share link.

More diagram types