Activity diagrams: swimlanes / partitions

Activity diagrams: swimlanes / partitions

puml.online

简介 / Introduction

Activity diagrams describe the flow of actions in a business process. Swimlanes group actions by responsible party or system partition, making the flow clear at a glance. PlantUML has native swimlane syntax; Mermaid approximates it with flowchart subgraphs.

PlantUML 版

PlantUML uses |partition name| to declare swimlanes; actions inside a partition belong to that lane.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@startuml
|Order Processing|
:Receive customer order;
|Inventory Management|
:Check stock;
|Shipping|
:Pack items;
|Order Processing|
:Send confirmation email;
|Inventory Management|
if (Stock available?) then (Yes)
:Update inventory records;
else (No)
:Generate restock alert;
endif
|Shipping|
:Arrange courier;
@enduml

PlantUML swimlanes are automatically arranged vertically, with arrows connecting action nodes across partitions.

Mermaid 版

Mermaid flowchart has no native swimlane syntax; use subgraph with LR or TD direction to approximate partitions:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
flowchart LR
subgraph "Order Processing"
A1[Receive order] --> A2[Send confirmation]
end
subgraph "Inventory Management"
B1[Check stock] --> B2{Available?}
B2 -->|Yes| B3[Update records]
B2 -->|No| B4[Generate restock alert]
end
subgraph Shipping
C1[Pack items] --> C2[Arrange courier]
end
A1 --> B1
B3 --> C1
B4 --> C1
A2 -->|notify| A1

Note that Mermaid subgraphs do not auto-align between groups; you must manually order nodes to simulate swimlane behavior.

对比 / Side-by-side

Feature PlantUML Mermaid
Swimlane syntax |partition| native No native swimlanes, use subgraph
Partition layout Auto vertical alignment Manual node ordering required
Conditional branch if/else/endif B2{} decision node
Parallel paths fork/join Not supported
Diagram type activity diagram flowchart

小结 / Wrap-up

PlantUML’s |swimlane| syntax is the standard implementation for activity diagram swimlanes, ideal for formal business process documentation. Mermaid approximates swimlanes with flowchart subgraphs — faster to set up and integrate — but requires extra care for partition alignment. For precise swimlane layout, use PlantUML; if you are already in the Mermaid ecosystem, the subgraph compromise is acceptable.

  • Title: Activity diagrams: swimlanes / partitions
  • Author: puml.online
  • Created at : 2026-09-08 09:00:00
  • Updated at : 2026-09-29 01:06:38
  • Link: https://puml.online/blog/activity-diagram-swimlanes-en/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Activity diagrams: swimlanes / partitions