πŸ§œβ€β™€οΈMermaid-Sequence

Cheat Sheet for Mermaid.

2. Sequence Diagrams

A Sequence diagram is an interaction diagram that shows how processes operate with one another and in what order.


2.1 Participants

The participants or actors are rendered in order of appearance in the diagram source text.

Feature
Diagram

You can specify the actor's order of appearance to show the participants in a different order.

You can specify the actor’s order of appearance to show the participants in a different order.

The participants can be defined implicitly without specifying them with the `participant` keyword.


2.2 Aliases

The participant can have a convenient identifier and a descriptive label.

sequenceDiagram
    participant A as Alice
    participant J as John
    A->>J: Hello John, how are you?
    J-->>A: Great!

2.3 Messages

Messages can be of two displayed either solid or with a dotted line.

There are six types of arrows currently supported:

Arrow Type
Description

->

Solid line without arrow

-->

Dotted line without arrow

->>

Solid line with arrowhead

-->>

Dotted line with arrowhead

-x

Solid line with a cross at the end (async)

--x

Dotted line with a cross at the end (async)

2.4 Activations

Feature
Diagram

Activate and deactivate an actor.

Shortcut notation by appending `+/-` suffix to the message arrow.

Activations can be stacked for same actor:

2.5 Notes

Add notes to a sequence diagram by the notation Note.

  1. Right Side

  1. Left Side

  1. Over

  1. Create notes spanning two participants

2.6 Loops

Express loops in a sequence diagram by the notation loop.

2.7 Alt

Express alternative paths in a sequence diagram by the notation alt.

Or, if there is sequence that is optional (if without else).

Example:

4. Demos

4.4 Basic Sequence Diagram

4.5 Message to Self in Loop

5. References

Last updated

Was this helpful?