merIDK / Diagram types / Sankey diagram
Mermaid Sankey diagram: example and syntax
Sankey diagrams show flows between stages, with each band as wide as the amount it carries. Use them for budgets, energy use, traffic sources and funnels.
Open this example in the editor
Example code
sankey-beta
Salary,Rent,1200
Salary,Food,450
Salary,Savings,600
Salary,Fun,250
Savings,Index fund,400
Savings,Emergency,200
Result
sankey-beta Salary,Rent,1200 Salary,Food,450 Salary,Savings,600 Salary,Fun,250 Savings,Index fund,400 Savings,Emergency,200
Syntax quick reference
- The data is CSV:
source,target,value, one flow per line. - Put names that contain commas in double quotes.
- A node can be the target of one row and the source of another.
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.