The Mermaid cheatsheet
Every shape, arrow, and keyword you actually use — on one page.
Flowchart
full reference →Direction
| TD | top-down |
| LR | left-right |
| BT | bottom-top |
| RL | right-left |
Node shapes
| A[rect] | rectangle |
| B(round) | rounded |
| C{diamond} | decision |
| D((circle)) | circle |
| E>flag] | flag |
| F[/parallelogram/] | parallelogram |
Arrows
| A --> B | solid |
| A -.-> B | dotted |
| A ==> B | thick |
| A -- text --> B | with label |
Sequence
full reference →Arrows
| A->>B | solid (sync) |
| A-->>B | dashed (response) |
| A-xB | lost |
| A-)B | async open |
Blocks
| loop label | iterate |
| alt cond | branch |
| opt cond | optional |
| note over A,B | note |
Helpers
| autonumber | number arrows |
| participant A as Alice | alias |
| activate A / deactivate A | lifelines |
State
full reference →States
| [*] | start/end |
| state Comp { … } | composite |
| <<fork>> | fork |
| <<join>> | join |
Transitions
| A --> B: event | labeled |
| A --> B: e [guard] | with guard |
Cardinality
| ||--|| | one to one |
| ||--o{ | one to many |
| }o--o{ | many to many |
| }|--|| | mandatory many to one |
Attributes
| uuid id PK | primary key |
| uuid org_id FK | foreign key |
| string email UK | unique |
Class
full reference →Visibility
| + public | public |
| - private | private |
| # protected | protected |
| ~ package | package |
Relations
| A <|-- B | inheritance |
| A *-- B | composition |
| A o-- B | aggregation |
| A --> B | association |
Gantt
full reference →Tasks
| :id, start, dur | with id |
| :after id, dur | depend on |
| :milestone, date, 0d | milestone |
Status
| done, | completed |
| active, | in progress |
| crit, | critical |