Activity diagram

An activity diagram describes a workflow or process: the steps, the order they happen in, and the decisions and parallel paths along the way. It's well suited to business processes, algorithms, and anything that flows from a start to an end.

In PlantUML, you write each activity on its own line, using arrows and keywords like if, repeat, and fork to express control flow. The diagram is generated for you.

If you're maintaining older diagrams, the previous syntax is still supported but no longer recommended for new diagrams.

See common commands for features available across all diagram types.

Simple action

Activities label starts with : and ends with ;.

Text formatting can be done using creole wiki syntax.

They are implicitly linked in their definition order.

Other simple action (defined as a list)

Simple action list separated by -

Simple action list separated by *

With one level

With several levels

[Ref. GH-2376]

Start/Stop/End

You can use start and stop keywords to denote the beginning and the end of a diagram.

You can also use the end keyword.

Conditional [if, then, else, endif]

You can use if, then, else and endif keywords to put tests in your diagram. Labels can be provided using parentheses.

The 3 syntaxes are possible:

[Ref. QA-301]

Several tests (horizontal mode)

You can use the elseif keyword to have several tests (by default, it is the horizontal mode):

Several tests (vertical mode)

You can use the command !pragma useVerticalIf on to have the tests in vertical mode:

You can use the -P command-line option to specify the pragma:

java -jar plantuml.jar -PuseVerticalIf=on

[Refs. QA-3931, GH-582]

Switch and case [switch, case, endswitch]

You can use switch, case and endswitch keywords to put switch in your diagram.

Labels can be provided using parentheses.

Conditional with stop on an action [kill, detach]

You can stop action on a if loop.

But if you want to stop at the precise action, you can use the kill or detach keyword:

[Ref. QA-265]

Repeat loop

Simple repeat loop

You can use repeat and repeat while keywords to have repeat loops.

Repeat loop with repeat action and backward action

It is also possible to use a full action as repeat target and insert an action in the return path using the backward keyword.

[Ref. QA-5826]

Break on a repeat loop [break]

You can use the break keyword after an action on a loop.

[Ref. QA-6105]

Goto and Label Processing [label, goto]

⚠ It is currently only experimental 🚧

You can use label and goto keywords to denote goto processing, with:

[Ref. QA-15026, QA-12526 and initially QA-1626]

While loop

Simple while loop

You can use while and endwhile keywords to have while loop.

It is possible to provide a label after the endwhile keyword, or using the is keyword.

While loop with backward action

It is also possible to insert an action in the return path using the backward keyword.

[Ref. QA-11144]

Infinite while loop

If you are using detach to form an infinite while loop, then you will want to also hide the partial arrow that results using -[hidden]->

Parallel processing [fork, fork again, end fork, end merge]

You can use fork, fork again and end fork or end merge keywords to denote parallel processing.

Simple fork

fork with end merge

[Ref. QA-5320]

[Ref. QA-13731]

Label on end fork (or UML joinspec):

[Ref. QA-5346]

Other example

Split processing

Split

You can use split, split again and end split keywords to denote split processing.

Input split (multi-start)

You can use hidden arrows to make an input split (multi-start):

[Ref. QA-8662]

Output split (multi-end)

You can use kill or detach to make an output split (multi-end):

Notes

Text formatting can be done using creole wiki syntax.

A note can be floating, using floating keyword.

You can add note on backward activity:

[Ref. QA-11788]

You can add note on partition activity:
[Ref. QA-2398]

Colors

You can specify a color for some activities.

You can also use gradient color.
[Ref. QA-4906]

Lines without arrows

You can use skinparam ArrowHeadColor none in order to connect activities using lines only, without arrows.

Arrows

Using the -> notation, you can add texts to arrow, and change their color.

It's also possible to have dotted, dashed, bold or hidden arrows.

Simple colored arrow [link]

You can use simple colored arrow with the link keyword.

Multiple colored arrow

You can use multiple colored arrow.

[Ref. QA-4411]

Connector (or Circle)

You can use parentheses to denote connector.

Color on connector

You can add color on connector.

[Ref. QA-10077]

And even use style on Circle:

[Ref. QA-19975]

Grouping or partition

Group

You can group activity together by defining group:

Partition

You can group activity together by defining partition:

It's also possible to change partition color:

[Ref. QA-2793]

It's also possible to add link to partition:
[Ref. QA-542]

Group, Partition, Package, Rectangle or Card

You can group activity together by defining:

Swimlanes

Using pipe |, you can define swimlanes.

It's also possible to change swimlanes color.

You can add if conditional or repeat or while loop within swimlanes.

You can also use alias with swimlanes, with this syntax:

[Ref. QA-2681]

Detach or kill [detach, kill]

It's possible to remove an arrow using the detach or kill keyword:

Emoji as action (with icon stereotype)

You can use emoji as action, with the stereotype <<icon>>:

[Ref. GH-2436]

SDL (Specification and Description Language) (with SDL sterotype)

Table of SDL Shape Name

Name Stereotype syntax Deprecated syntax
Input <<input>> <
Output <<output>> >
Procedure <<procedure>> |
Load <<load>> \
Save <<save>> /
Continuous <<continuous>> }
Task <<task>> ]

[Ref. QA-11518, GH-1270]

SDL using stereotype (Current official form)

UML (Unified Modeling Language) Shape (with UML stereotype)

Table of UML Shape Name

Name Stereotype syntax
ObjectNode <<object>>
ObjectNode
typed by signal
<<objectSignal>> or <<object-signal>>
AcceptEventAction
without TimeEvent trigger
<<acceptEvent>> or <<accept-event>>
AcceptEventAction
with TimeEvent trigger
<<timeEvent>> or <<time-event>>
SendSignalAction

SendObjectAction
with signal type
<<sendSignal>> or <<send-signal>>
Trigger <<trigger>>

[Ref. GH-2185]

UML Shape Example using Stereotype

[Ref. GH-2185, QA-16558, GH-1659]

Complete example

Condition Style

Inside style (by default)

Diamond style

InsideDiamond (or Foo1) style

[Ref. QA-1290 and #400]

Condition End Style

Diamond style (by default)

Horizontal line (hline) style

[Ref. QA-4015]

Using (global) style

Without style (by default)

With style

You can use style to change rendering of elements.

Creole on Activity

You can use Creole or HTML Creole on Activity diagram: