Sequence diagrams: alt / opt / loop / par / critical / break / note
Sequence diagrams aren’t just
A -> B. The control-flow keywords are what make them useful.
alt / else — branches
The most common pattern. alt is “if”, else is “else”:
1 | @startuml |
Three flat branches; else follows alt, multiple else are valid.
opt — optional block
1 | opt has refresh_token |
opt has no else; equivalent to if (cond) { ... }.
loop — iteration
1 | loop every 10s |
The label after loop shows up on the divider.
par — parallel branches
1 | par |
Two things happen at once — common for concurrent frontend requests.
critical — try/recover style
1 | critical DB write |
option = else, but reads better for error-handling flows.
break — early exit
1 | break user cancelled |
break jumps out of the rest of the sequence. Useful for cancellation paths.
note — annotations
Place alongside a lifeline or spanning several:
1 | note over FE, API |
note over A, B for multi-actor spans; note left of A / note right of A for single-sided.
Real example
A “payment” sequence stitching several of the above together:
1 | @startuml |
Tips
alt/parmust end withend. One missingendand the whole diagram fails silently.- If a
note overbody contains,or:, wrap it in triple-quotes:note over A """multi-line with, chars""". - In
looplabels, stick to ASCII numbers and English words. Some renderers choke on full-width characters in label lines.
- Title: Sequence diagrams: alt / opt / loop / par / critical / break / note
- Author: puml.online
- Created at : 2026-07-29 14:10:00
- Updated at : 2026-08-14 21:34:29
- Link: https://puml.online/blog/plantuml-sequence-control-en/
- License: This work is licensed under CC BY-NC-SA 4.0.