A Sequence diagram is an interaction diagram that shows how processes operate with one another and in what order.
Example 1
sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!
Example 2
sequenceDiagram
participant John
participant Alice
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Example 3
sequenceDiagram
participant A as Alice
participant J as John
A->>J: Hello John, how are you?
J->>A: Great!
Example 4
sequenceDiagram
Alice->>+John: Hello John, how are you?
John-->>-Alice: Great!
Example 5
sequenceDiagram
Alice->>+John: Hello John, how are you?
Alice->>+John: John, can you hear me?
John-->>-Alice: Hi Alice, I can hear you!
John-->>-Alice: I feel great!
Example 6
sequenceDiagram
participant John
Note right of John: Text in note
Example 7
sequenceDiagram
Alice->John: Hello John, how are you?
Note over Alice,John: A typical interaction
Example 8
loop Loop text
... statements ...
end
Example 9
sequenceDiagram
Alice->John: Hello John, how are you?
loop Every minute
John-->Alice: Great!
end
Example 10
alt Describing text
... statements ...
else
... statements ...
end
Example 11
opt Describing text
... statements ...
end
Example 12
sequenceDiagram
Alice->>Bob: Hello Bob, how are you?
alt is sick
Bob->>Alice: Not so good :(
else is well
Bob->>Alice: Feeling fresh like a daisy
end
opt Extra response
Bob->>Alice: Thanks for asking
end
Example 13
par [Action 1]
... statements ...
and [Action 2]
... statements ...
and [Action N]
... statements ...
end
Example 14
rect rgb(0, 255, 0)
... content ...
end
Example 15
rect rgba(0, 0, 255, .1)
... content ...
end
Example 16
sequenceDiagram
Alice->>John: Hello John, how are you?
%% this is a comment
John-->>Alice: Great!
Example 17
Example 18
sequenceDiagram
autonumber
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
Example 19
sequenceDiagram
Alice->>John: Hello John, how are you?
activate John
John-->>Alice: Great!
deactivate John