Sequence Diagram
Last updated:
Mermaid Studio provides full language support for Sequence diagrams inside IntelliJ IDEA and other JetBrains IDEs. Sequence diagrams show how processes interact with each other over time, and are essential for documenting API flows, system integrations, and protocol specifications.
Syntax Highlighting
Section titled “Syntax Highlighting”Syntax highlighting integrates directly with IntelliJ’s color scheme system, so diagram colors always match your editor theme.
IDE Support
Section titled “IDE Support”Mermaid Studio provides comprehensive support for sequence diagrams:
- Syntax highlighting for participants and messages, with embedded-JSON highlighting inside
propertiesandlinksblocks so the JSON keys and values stay readable. - Code completion for participant names and message syntax. Top-level-only keywords (
title,accTitle,accDescr,autonumber,properties,details,link,links) are filtered out inside control-flow blocks (loop,alt,opt,par,critical,break,rect) where Mermaid wouldn’t accept them. - Live templates — 31 abbreviations covering block wrappers, notes, participants and actors (including typed-metadata
@{type: ...}forms), messages (with amsgarrow-picker macro), and autonumber. - Documentation hover for element information
- Rename refactoring to update participant names
- Find usages to locate participant references
- Code folding for every block keyword, including
boxandpar_over. - Formatting to clean up diagram structure. Empty
box/loop/alt/rectno longer accumulate a blank line on every reformat, and a titlelessboxorrectkeeps its first content line on its own row. - Block-body isolation — a parse error inside one block body no longer cascades to its siblings or the rest of the file; each block reparses independently.
- Inspections to catch common errors:
- Trailing whitespace after a
@{...}participant / actor attributes block when noasfollows (with a one-click fix to strip the space). - Non-participant / non-actor statements inside a
box(Mermaid only renders box content of those two kinds). - Participant declared inside control flow (now covers
par_overtoo) — with a quick fix that moves the declaration to top level. - Decimal autonumber values (
autonumber 1.1 0.1) are validated and trailing whitespace on the autonumber statement is flagged on Mermaid 11.15.0+.
- Trailing whitespace after a
- Brace matching for block navigation. Pressing Enter inside inline
properties/linksJSON no longer triggers comma insertion or brace-pair expansion. - Color provider for customizing diagram colors
Live templates
Section titled “Live templates”A set of 31 context-aware live templates scaffolds the block keywords, participant and actor declarations, notes, messages, and autonumber statements that sequence diagrams use day-to-day. Type a short abbreviation, accept it from the completion popup, and tab through the template variables.
Individual abbreviations can be toggled under Settings > Tools > Mermaid Studio > Live Templates in the Sequence Diagram group. See Live Templates for the cross-cutting mechanics (triggering, contextual visibility, configuration).
Block wrappers
Section titled “Block wrappers”| Abbreviation | Expansion |
|---|---|
bloop | loop ... end |
balt | alt ... else ... end |
bopt | opt ... end |
bpar | par ... and ... end |
bcrit | critical ... option ... end |
bbrk | break ... end |
bbox | Participant grouping box (box ... end) |
brect | Background rectangle (rect rgb(...) ... end) |
| Abbreviation | Expansion |
|---|---|
nl | Note left of participant |
nr | Note right of participant |
no | Note over participant |
Participants and actors
Section titled “Participants and actors”The prta and atra templates produce as-aliased declarations; cprta and catra produce the create variants.
The prj and atj templates use the typed-metadata @{type: ...} form (Mermaid 11.13.0+); cprj and catj produce the create variants of those.
| Abbreviation | Expansion |
|---|---|
prta | participant X as "Label" |
atra | actor X as "Label" |
cprta | create participant X as "Label" |
catra | create actor X as "Label" |
prj | participant X@{type: ...} (11.13.0+) |
atj | actor X@{type: ...} (11.13.0+) |
cprj | create participant X@{type: ...} |
catj | create actor X@{type: ...} |
Messages
Section titled “Messages”msg is the generic form: it expands the arrow as a picker variable, so you choose the operator on insert.
The other ten templates each hard-code one operator for when you already know the shape you want.
| Abbreviation | Expansion |
|---|---|
msg | Message with arrow picker (A -> B: text) |
ms | Solid line, no arrowhead (A -> B: text) |
msf | Solid line with arrowhead (A ->> B: text) |
md | Dotted line, no arrowhead (A --> B: text) |
mdf | Dotted line with arrowhead (A -->> B: text) |
mc | Solid line with cross (A -x B: text) |
mdc | Dotted line with cross (A --x B: text) |
ma | Async solid arrow (A -) B: text) |
mda | Async dotted arrow (A --) B: text) |
mb | Bidirectional solid (A <<->> B: text) |
mdb | Bidirectional dotted (A <<-->> B: text) |
Autonumbering
Section titled “Autonumbering”| Abbreviation | Expansion |
|---|---|
autns | autonumber 10 10 (start + step) |
Quick Syntax Reference
Section titled “Quick Syntax Reference”Participants
Section titled “Participants”sequenceDiagram participant A as Alice participant B as Bob A->>B: HelloMessage Types
Section titled “Message Types”| Syntax | Meaning |
|---|---|
-> | Solid line |
--> | Dashed line |
->> | Solid with arrowhead |
-->> | Dashed with arrowhead |
-x | Solid with cross |
--x | Dashed with cross |
<->> | Bidirectional |
-) | Half-arrow (Mermaid 11.13.0+) |
--) | Dashed half-arrow (Mermaid 11.13.0+) |
Activation
Section titled “Activation”sequenceDiagram Client->>+Server: Request Server-->>-Client: ResponsesequenceDiagram Alice->>Bob: Hello Note right of Bob: Bob thinks Bob-->>Alice: Hi!For full syntax details, see the Mermaid sequence diagram documentation.