Eriksen Labs Support
Documentation

Mermaid reference: kinds of diagram

v2.10.0Updated

The full syntax, colors, exports and limits of Mermaid & PlantUML Diagrams for Confluence. It is written for people who already write Mermaid.

New to Mermaid? Start with the guide. Syntax not covered here is on mermaid.js.org.

This page uses Mermaid's word node (box) for a shape in a diagram. Every fact here is true of version 2.10.0. PlantUML, which 2.10.0 adds, has a reference of its own.

On this page
  1. Flowchart
  2. Sequence diagram
  3. Entity relationship diagram
  4. Mermaid Gantt chart syntax
  5. Class diagram
  6. State diagram
  7. Pie chart
  8. Mind map
  9. The other 24 kinds

The first line that is not blank, a comment or front matter sets the kind. The app draws 32 kinds, with Mermaid 12.3.0. Each has an example under Examples and a Syntax reference panel of its own. Eight examples are buttons, and the other 24 are in the More… list beside them.

First lineKindIn ExamplesSyntax reference panel
The eight buttons
flowchart or graphFlowchartFlowchartFlowchart
sequenceDiagramSequence diagramSequenceSequence diagram
erDiagramEntity relationship diagramERDEntity relationship
ganttGantt chartGanttGantt chart
classDiagramClass diagramClassClass diagram
stateDiagram-v2State diagramStateState diagram
piePie chartPiePie chart
mindmapMind mapMind mapMind map
Under More…
journeyUser journeyUser journeyUser journey
timelineTimelineTimelineTimeline
quadrantChartQuadrant chartQuadrant chartQuadrant chart
gitGraphGit graphGit graphGit graph
C4Context; also C4Container, C4Component, C4Dynamic, C4DeploymentC4 diagramC4C4 diagram
requirementDiagramRequirement diagramRequirementRequirement diagram
sankeySankey diagramSankeySankey diagram
xychartXY chart: bars and linesXY chartXY chart
blockBlock diagramBlockBlock diagram
packetPacket diagramPacketPacket diagram
kanbanKanban boardKanbanKanban board
architecture-betaArchitecture diagramArchitectureArchitecture diagram
radar-betaRadar chartRadarRadar chart
treemap-betaTreemapTreemapTreemap
treeView-betaTree view of files and foldersTree viewTree view
ishikawa-betaFishbone (Ishikawa) diagramFishboneFishbone diagram
venn-betaVenn diagramVennVenn diagram
usecase-betaUse case diagramUse caseUse case diagram
swimlane-betaSwimlane diagramSwimlanesSwimlane diagram
wardley-betaWardley mapWardley mapWardley map
cynefin-betaCynefin diagramCynefinCynefin diagram
railroad-ebnf-betaRailroad (grammar) diagramRailroadRailroad diagram
eventmodelingEvent modelEvent modelEvent model
agentflow-betaAgent flowAgent flowAgent flow

The first line in the table is the one the kind's example starts with. Any first line the panel does not recognize shows the flowchart panel. ZenUML is not drawn: Mermaid publishes it as a separate package, which the app does not include. Mermaid's full syntax for every kind is on mermaid.js.org.

Flowchart

In the Syntax reference panel

WriteMeaning
Shapes
A[Rectangle]Standard box
A(Rounded)Rounded box
A([Stadium])Pill shape
A{Decision}Diamond — a yes/no branch
A((Circle))Circle
A[(Database)]Cylinder
A[[Subroutine]]Box with side bars
Arrows
A --> BSolid arrow
A --- BLine, no arrowhead
A -.-> BDotted arrow
A ==> BThick arrow
A -->|label| BArrow with a label
Direction
flowchart LRLeft to right
flowchart TDTop down
Color
style A fill:#ffd966Fill one node
style A fill:#ffd966,stroke:#b45309,stroke-width:2pxFill + border
classDef warn fill:#fee2e2,stroke:#dc2626Define a reusable style
class A,B warnApply that style to nodes

The panel also has a Links group; see Links.

More

WriteMeaning
flowchart TB, RL, BTTop to bottom (the same as TD), right to left, bottom to top
subgraph id [Title] … endA labeled group of nodes
A["Cost (EUR)"]A label with brackets or other symbols, in double quotes
A["Line one<br>Line two"]A line break in a label
%% noteA comment, not drawn. It needs a line of its own: after other text on a line, it is a parse error.

end is a reserved word, so a node cannot be called end. Use End or done.

Subgraphs that set their own direction

A subgraph can hold a direction line of its own, such as direction TB in a flowchart that runs left to right. Mermaid 12 does not always follow it. Before version 2.9 the app drew with Mermaid 11.16, which did.

  • Standard layout. A subgraph loses its direction when an arrow has one end inside it and the other outside. An arrow from or to the subgraph itself, as in One --> Two, costs it nothing.
  • ELK layout. An arrow whose two ends do not sit directly in the same subgraph costs every subgraph between either end and the subgraph that holds both its direction.
  • A subgraph whose direction is the same as that of the diagram around it loses nothing.

When a flowchart draws and a subgraph is not drawn in its own direction, the editor shows a note under the status line, Subgraph direction not followed. It names the subgraphs, gives the reason and says what to write for each arrow, as in "Arrow A2 to B1: write One for A2 and Two for B1." It lists three arrows and counts the rest, which appear as the first are changed. For a subgraph written without an id, such as subgraph Team A, it gives the line that sets one: subgraph TeamA [Team A].

  • The diagram is valid and saves as it is. The editor never changes the source itself.
  • In eleven test diagrams with the standard layout, writing the arrows as the note says gave back the drawing from before 2.9: ten exactly, and one with 0.08% of its pixels different.
  • The note misses one rare case in the standard layout: an arrow to a subgraph that is itself crossed, three levels deep.
  • The note does not show while the license is not active.
  • State diagrams are not affected: a composite state's own direction is drawn as before.

Mermaid's page: Flowcharts. Recipe: Draw a process. Guide: A flowchart whose subgraphs lost their direction.

Sequence diagram

In the Syntax reference panel

WriteMeaning
Basics
participant BobDeclare a participant
A->>B: HelloSolid arrow with message
A-->>B: Hi backDashed reply arrow
A-)B: AsyncOpen arrowhead
Structure
Note over A,B: textNote spanning participants
loop Every minuteStart a loop block (end with end)
alt SuccessConditional block (else / end)
activate AShow A as busy (deactivate A)

More

WriteMeaning
autonumberNumber every message
actor CustomerA participant drawn as a person
participant Desk as Service deskA short name with a longer label
Note left of A: text, Note right of A: textA note beside one participant
opt … endAn optional block
par … and … endBlocks that happen at the same time
A->>+B: Hi, B-->>-A: DoneActivate B with the first message, deactivate it with the reply

Mermaid's page: Sequence diagrams. Recipe: Show who talks to whom.

Entity relationship diagram

In the Syntax reference panel

WriteMeaning
Relationships
A ||--|| B : labelExactly one to exactly one
A ||--o{ B : labelOne to zero-or-many
A ||--|{ B : labelOne to one-or-many
A }o--o{ B : labelMany to many
Reading the symbols
||Exactly one
o|Zero or one
}|One or many
}oZero or many
Attributes
CUSTOMER { string name }, one field per lineFields go in braces
string name PKMark a primary key

More

WriteMeaning
A ||--o{ B : "appears on"A relationship label with spaces, in double quotes
A ||..o{ B : labelA dashed line: a non-identifying relationship
int customer_id FKMark a foreign key; UK marks a unique key

Mermaid's page: Entity relationship diagrams. Recipe: Document tables.

Mermaid Gantt chart syntax

A Gantt chart starts with gantt and a dateFormat, then one task per line: its name, a colon, then optional tags (done, active, crit, milestone) and an id, a start date or after another task, and a length such as 3d. Examples to copy are in the recipes.

In the Syntax reference panel

WriteMeaning
Structure
title My PlanChart title
dateFormat YYYY-MM-DDHow dates are written
section BuildGroup tasks under a heading
Tasks
Design :des1, 2026-08-01, 7did, start date, duration
Dev :active, dev1, after des1, 14dStarts when des1 ends
Test :done, tst1, 2026-08-20, 5dCompleted task
Launch :milestone, 2026-09-01, 0dMilestone marker

More

WriteMeaning
axisFormat %d %bHow the axis writes dates, here 05 Oct
tickInterval 1weekOne axis mark per week; also day, month and shorter units
excludes weekendsSkip Saturdays and Sundays; also takes weekday names and dates, separated by commas
weekend fridayWith excludes weekends, skip Friday and Saturday instead; also weekend saturday
includes 2026-12-27Keep a date that excludes would skip
todayMarker offHide the line that marks today
todayMarker stroke-width:3px,stroke:#1f9e7dStyle that line
inclusiveEndDatesAn end date counts as a day of the task
done, active, crit, milestoneTags before the id. They can be combined, as in crit, active
after id, after id1 id2Start when the task ends; with several ids, when the last of them ends
until idEnd when that task starts

A task's start is a date or after. Its end is a length, a date, or until.

A length is a number and a unit: ms, s, m, h, d, w, M or y. Lowercase m is minutes, and capital M is months.

A # or ; after a task's colon causes an error. Write dates the way dateFormat says.

Mermaid's page also lists topAxis. In the Mermaid this app includes, it causes an error, so leave it out.

Mermaid's page: Gantt diagrams. Recipe: Plan a project timeline.

Class diagram

In the Syntax reference panel

WriteMeaning
Members
+namePublic
-secretPrivate
#internalProtected
+total() floatMethod with return type
Relationships
A <|-- BB inherits from A
A *-- BComposition
A o-- BAggregation
A --> B : labelAssociation
A "1" --> "*" BWith multiplicity

More

WriteMeaning
class Order { … }A class and its members, one per line
A ..> BDependency
A ..|> BRealisation
<<interface>> ShapeAn annotation on a class

Mermaid's page: Class diagrams. There is no recipe for class diagrams; start from the Class example.

State diagram

In the Syntax reference panel

WriteMeaning
Basics
[*] --> DraftStart state
Draft --> [*]End state
A --> B : triggerTransition with label
Grouping
state "Long name" as s1Alias a state
state Fork <<fork>>Fork / join node
note right of A : textAttach a note

More

WriteMeaning
state Review { … }A state with states inside it
state Check <<choice>>A choice between paths
direction LRDraw from left to right

Mermaid's page: State diagrams. Recipe: Show how statuses change.

Pie chart

In the Syntax reference panel

WriteMeaning
Basics
pie title My ChartChart heading
"Label" : 45One slice and its value
showDataShow numbers on the chart

showData goes on the first line, after pie. It adds each value to the key, in square brackets. A title can also go on a line of its own, as title Tickets by channel.

Mermaid's page: Pie charts. Recipe: Show shares of a whole.

Mind map

In the Syntax reference panel

WriteMeaning
Basics
root((Centre))Central node
  ChildIndent two spaces per level
id[Square]Square node
id(Rounded)Rounded node

More

WriteMeaning
id((Circle))Circle
id))Bang((Bang
id)Cloud(Cloud
id{{Hexagon}}Hexagon

A node's level comes from its indentation, compared with the lines above it.

Mermaid's page: Mind maps. Recipe: Map ideas.

The other 24 kinds

Each kind under More… has an example and a Syntax reference panel in the editor, and is a Diagram type in Draft with AI. This page does not repeat those panels; Kinds of diagram lists the 24. Two of them have something worth knowing here.

XY chart: the legend

An XY chart lists the names of its lines and bars in a legend. A line or bar has a name when it is written with one, as in line "Target" [35, 45, 50]. Before version 2.9, those names were not shown. To leave the legend out of one chart, begin the diagram with:

Mermaid
---
config:
  xyChart:
    showLegend: false
---

Timeline: sections

In a timeline with section headings, periods written above the first heading are not drawn. Put every period under a heading, or use no headings.

Recipes: Map a customer journey and Show a timeline.