PlantUML Language Reference Guide en
PlantUML Language Reference Guide en
1 Sequence Diagram
@enduml
You can use the order keyword to customize the display order of participants.
@startuml
participant Last order 30
participant Middle order 20
participant First order 10
@enduml
You can put the text of the response message below the arrow, with the skinparam responseMessageBelowArrow
true command.
@startuml
skinparam responseMessageBelowArrow true
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
You can specify a startnumber with autonumber //start// , and also an increment with autonumber //start//
//increment//.
@startuml
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber 15
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response
autonumber 40 10
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
You can specify a format for your number by using between double-quote.
The formatting is done with the Java class DecimalFormat (0 means digit, # means digit and zero if absent).
You can use some html tag in the format.
@startuml
autonumber "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber 15 "<b>(<u>##</u>)"
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response
@enduml
You can also use autonumber stop and autonumber resume //increment// //format// to respectively
pause and resume automatic numbering.
@startuml
autonumber 10 10 "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber stop
Bob -> Alice : dummy
autonumber stop
Bob -> Alice : dummy
@enduml
newpage
• critical
• group, followed by a text to be displayed
It is possible to add a text that will be displayed into the header (except for group).
The end keyword is used to close the group.
Note that it is possible to nest groups.
@startuml
Alice -> Bob: Authentication Request
end
@enduml
You can have a multi-line note using the end note keywords.
@startuml
Alice->Bob : hello
note left: this is a first note
Bob->Alice : ok
note right: this is another note
Bob->Bob : I am thinking
note left
a note
can also be defined
on several lines
end note
@enduml
note over Alice, Bob #FFAAAA: This is displayed\n over Bob and Alice.
note left
This is **bold**
This is //italics//
This is ""monospaced""
This is --stroked--
This is __underlined__
This is ~~waved~~
end note
1.16 Divider
If you want, you can split a diagram using == separator to divide your diagram into logical steps.
@startuml
== Initialization ==
== Repetition ==
@enduml
1.17 Reference
You can use reference in a diagram, using the keyword ref over.
@startuml
participant Alice
actor Bob
1.18 Delay
You can use ... to indicate a delay in the diagram. And it is also possible to put a message with this delay.
@startuml
@enduml
1.20 Space
You can use ||| to indicate some spacing in the diagram.
It is also possible to specify a number of pixel to be used.
@startuml
@enduml
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: RequestCreated
deactivate B
@enduml
Nested lifeline can be used, and it is possible to add a color on the lifeline.
@startuml
participant User
B --> A: RequestCreated
deactivate B
deactivate A
A -> User: Done
deactivate A
@enduml
@enduml
1.22 Return
Command return generates a return message with optional text label.
The return point is that which caused the most recent life-line activation.
The syntax is return label where label if provided is any string acceptable for conventional messages.
@startuml
Bob -> Alice : hello
activate Alice
Alice -> Alice : some action
return bye
@enduml
create Other
Alice -> Other : new
@enduml
activate A
A<--] : RequestCreated
deactivate A
[<- A: Done
deactivate A
@enduml
[<- Bob
[x<- Bob
Bob ->]
Bob ->o]
Bob o->o]
Bob ->x]
Bob <-]
Bob x<-]
@enduml
@enduml
@enduml
By default, the guillemet character is used to display the stereotype. You can change this behavious using the
skinparam guillemet:
@startuml
@enduml
@startuml
@enduml
@enduml
@enduml
You can also define title on several lines using title and end title keywords.
@startuml
title
<u>Simple</u> communication example
on <i>several</i> lines and using <font color=red>html</font>
This is hosted by <img:sourceforge.jpg>
end title
@enduml
@enduml
hide footbox
title Foot Box removed
@enduml
1.31 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command:
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
You can also change other rendering parameter, as seen in the following examples:
@startuml
skinparam sequenceArrowThickness 2
skinparam roundcorner 20
skinparam maxmessagesize 60
skinparam sequenceParticipant underline
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
@enduml
@startuml
skinparam backgroundColor #EEEBDC
skinparam handwritten true
skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
}
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
@enduml
box "Foo1"
participant Alice1
participant Alice2
end box
box "Foo2"
participant Bob1
participant Bob2
end box
Alice1 -> Bob1 : hello
Alice1 -> Out : out
@enduml
2.1 Usecases
Use cases are enclosed using between parentheses (because two parentheses looks like an oval).
You can also use the usecase keyword to define a usecase. And you can define an alias, using the as keyword.
This alias will be used later, when defining relations.
@startuml
(First usecase)
(Another usecase) as (UC2)
usecase UC3
usecase (Last\nusecase) as UC4
@enduml
2.2 Actors
The name defining an actor is enclosed between colons.
You can also use the actor keyword to define an actor. An alias can be assigned using the as keyword and can be
used later instead of the actor's name, e. g. when defining relations.
You can see from the following examples, that the actor definitions are optional.
@startuml
:First Actor:
:Another\nactor: as Man2
actor Woman3
actor :Last actor: as Person1
@enduml
@startuml
:User: --> (Use)
"Main Admin" as Admin
"Use the application" as (Use)
Admin --> (Admin the application)
@enduml
@startuml
skinparam actorStyle awesome
:User: --> (Use)
"Main Admin" as Admin
"Use the application" as (Use)
Admin --> (Admin the application)
@enduml
[Ref. QA-10493]
@startuml
skinparam actorStyle Hollow
:User: --> (Use)
"Main Admin" as Admin
"Use the application" as (Use)
Admin --> (Admin the application)
@enduml
[Ref. PR#396]
@enduml
@enduml
2.7 Extension
If one actor/use case extends another one, you can use the symbol <|--.
@startuml
:Main Admin: as Admin
(Use the application) as (Use)
@enduml
2.9 Stereotypes
You can add stereotypes while defining actors and use cases using << and >>.
@startuml
User << Human >>
:Main Database: as MySql << Application >>
(Start) << One Shot >>
(Use the application) as (Use) << Main >>
@enduml
It is also possible to change arrow direction by adding left, right, up or down keywords inside the arrow:
@startuml
:user: -left-> (dummyLeft)
:user: -right-> (dummyRight)
:user: -up-> (dummyUp)
:user: -down-> (dummyDown)
@enduml
You can shorten the arrow by using only the first character of the direction (for example, -d- instead of -down-)
or the two first characters (-do-).
Please note that you should not abuse this functionality : Graphviz gives usually good results without tweaking.
And with the left to right direction parameter:
@startuml
left to right direction
:user: -left-> (dummyLeft)
:user: -right-> (dummyRight)
:user: -up-> (dummyUp)
:user: -down-> (dummyDown)
@enduml
@enduml
You may change to left to right using the left to right direction command. The result is often better with
this direction.
@startuml
@enduml
2.13 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
You can define specific color and fonts for stereotyped actors and usecases.
@startuml
skinparam handwritten true
skinparam usecase {
BackgroundColor DarkSeaGreen
BorderColor DarkSlateGray
ArrowColor Olive
ActorBorderColor black
ActorFontName Courier
@enduml
3 Class Diagram
@startuml
Class11 <|.. Class12
Class13 --> Class14
Class15 ..> Class16
Class17 ..|> Class18
Class19 <--* Class20
@enduml
@startuml
Class21 #-- Class22
Class23 x-- Class24
Class25 }-- Class26
Class27 +-- Class28
Class29 ^-- Class30
@enduml
@enduml
You can add an extra arrow pointing at one object showing which object acts on the other object, using < or > at
the begin or at the end of the label.
@startuml
class Car
@enduml
Object : equals()
ArrayList : Object[] elementData
ArrayList : size()
@enduml
class Flight {
flightNumber : Integer
departureTime : Date
}
@enduml
You can use {field} and {method} modifiers to override default behaviour of the parser about fields and methods.
@startuml
class Dummy {
{field} A field (despite parentheses)
{method} Some method
}
@enduml
class Dummy {
-field1
#field2
~method1()
+method2()
}
@enduml
You can turn off this feature using the skinparam classAttributeIconSize 0 command :
@startuml
skinparam classAttributeIconSize 0
class Dummy {
-field1
#field2
~method1()
+method2()
}
@enduml
==
things together.
__
You can have as many groups
as you want
--
End of class
}
class User {
.. Simple Getter ..
+ getName()
+ getAddress()
.. Some setter ..
+ setName()
__ private data __
int age
-- encrypted --
String password
}
@enduml
class Foo
note left: On last defined class
@enduml
class Foo
note left: On last defined class
note as N1
This note is <u>also</u>
<b><color:royalBlue>on several</color>
<s>words</s> lines
And this is hosted by <img:sourceforge.jpg>
end note
@enduml
class Dummy
Dummy --> Foo : A link
note on link #red: note that is red
@enduml
class ArrayList {
Object[] elementData
size()
}
enum TimeUnit {
DAYS
HOURS
MINUTES
}
annotation SuppressWarnings
@enduml
class Dummy1 {
+myMethods()
}
class Dummy2 {
+hiddenMethod()
}
hide members
hide <<Serializable>> circle
show Dummy1 methods
show <<Serializable>> fields
@enduml
class Foo1
class Foo2
hide Foo2
@enduml
@enduml
3.17 Packages
You can define a package using the package keyword, and optionally declare a background color for your package
(Using a html color code or name).
Note that package definitions can be nested.
@startuml
package net.sourceforge.plantuml {
Object <|-- Demo1
Demo1 *- Demo2
}
@enduml
@enduml
You can also define links between packages, like in the following example:
@startuml
package foo1.foo2 {
}
package foo1.foo2.foo3 {
class Object
}
@enduml
3.19 Namespaces
In packages, the name of a class is the unique identifier of this class. It means that you cannot have two classes
with the very same name in different packages.
In that case, you should use namespaces instead of packages.
You can refer to classes from other namespaces by fully qualify them. Classes from the default namespace are
qualified with a starting dot.
Note that you don't have to explicitly create namespace : a fully qualified class is automatically put in the right
namespace.
@startuml
class BaseClass
namespace net.foo {
net.dummy.Person <|- Person
.BaseClass <|-- Person
@enduml
set namespaceSeparator ::
class X1::X2::foo {
some info
}
@enduml
You can disable automatic package creation using the command set namespaceSeparator none.
@startuml
@enduml
It is also possible to change arrow direction by adding left, right, up or down keywords inside the arrow:
@startuml
foo -left-> dummyLeft
foo -right-> dummyRight
foo -up-> dummyUp
foo -down-> dummyDown
@enduml
You can shorten the arrow by using only the first character of the direction (for example, -d- instead of -down-)
or the two first characters (-do-).
Please note that you should not abuse this functionality : Graphviz gives usually good results without tweaking.
And with the left to right direction parameter:
@startuml
left to right direction
foo -left-> dummyLeft
foo -right-> dummyRight
foo -up-> dummyUp
foo -down-> dummyDown
@enduml
class Enrollment {
drop()
cancel()
}
@enduml
class Enrollment {
drop()
cancel()
}
@enduml
class StationCrossing {
+cost: TimeInterval
}
<> diamond
StationCrossing . diamond
diamond - "from 0..*" Station
diamond - "to 0..* " Station
@enduml
3.25 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
@startuml
skinparam class {
BackgroundColor PaleGreen
ArrowColor SeaGreen
BorderColor SpringGreen
}
skinparam stereotypeCBackgroundColor YellowGreen
@enduml
skinparam class {
BackgroundColor PaleGreen
ArrowColor SeaGreen
BorderColor SpringGreen
BackgroundColor<<Foo>> Wheat
BorderColor<<Foo>> Tomato
}
skinparam stereotypeCBackgroundColor YellowGreen
skinparam stereotypeCBackgroundColor<< Foo >> DimGray
Class01 <<Foo>>
Class03 <<Foo>>
Class01 "1" *-- "many" Class02 : contains
@enduml
@enduml
class Bar1
class Bar2
together {
class Together1
class Together2
class Together3
}
Together1 - Together2
Together2 - Together3
Together2 -[hidden]--> Bar1
Bar1 -[hidden]> Bar2
@enduml
class BaseClass
namespace net.foo {
net.dummy.Person <|- Person
.BaseClass <|-- Person
• without label
@startuml
class foo
foo --> bar
foo -[bold]-> bar1
foo -[dashed]-> bar2
foo -[dotted]-> bar3
foo -[hidden]-> bar4
foo -[plain]-> bar5
@enduml
• with label
@startuml
class foo
foo --> bar : �
foo -[bold]-> bar1 : bold
foo -[dashed]-> bar2 : dashed
foo -[dotted]-> bar3 : dotted
foo -[hidden]-> bar4 : hidden
foo -[plain]-> bar5 : plain
@enduml
• new method
@startuml
class foo
foo --> bar : normal
foo --> bar1 #line:red;line.bold;text:red : red bold
foo --> bar2 #green;line.dashed;text:green : green dashed
foo --> bar3 #blue;line.dotted;text:blue : blue dotted
@enduml
@enduml
@enduml
@enduml
4.4 Branches
You can use if/then/else keywords to define branches.
@startuml
(*) --> "Initialization"
@enduml
Unfortunately, you will have to sometimes repeat the same activity in the diagram text:
@startuml
(*) --> "check input"
If "input is verbose" then
--> [Yes] "turn on verbosity"
--> "run command"
else
--> "run command"
Endif
-->(*)
@enduml
if "" then
-> "action 3" as a3
else
if "Other test" then
-left-> "action 5"
else
--> "action 6"
endif
endif
else
endif
@enduml
4.6 Synchronization
You can use === code === to display synchronization bars.
@startuml
--> (*)
@enduml
When you declare activities, you can span on several lines the description text. You can also add in the description.
You can also give a short code to the activity with the as keyword. This code can be used latter in the diagram
description.
@startuml
(*) -left-> "this <size:20>action</size>
is <b>very</b> <color:red>long2</color>
and defined on several lines
that contains many <i>text</i>" as A1
4.7 Notes
You can add notes on a activity using the commands note left, note right, note top or note bottom, just
after the description of the activity you want to note.
If you want to put a note on the starting point, define the note at the very beginning of the diagram description.
You can also have a note on several lines, using the endnote keywords.
@startuml
@enduml
4.8 Partition
You can define a partition using the partition keyword, and optionally declare a background color for your
partition (Using a html color code or name)
When you declare activities, they are automatically put in the last used partition.
You can close the partition definition using a closing bracket }.
@startuml
partition Conductor {
(*) --> "Climbs on Platform"
--> === S1 ===
--> Bows
}
partition Conductor {
Bows --> === S2 ===
--> WavesArmes
Applauds --> === S2 ===
}
@enduml
4.9 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
You can define specific color and fonts for stereotyped activities.
@startuml
@enduml
4.10 Octagon
You can change the shape of activities to octagon using the skinparam activityShape octagon command.
@startuml
'Default is skinparam activityShape roundBox
skinparam activityShape octagon
@enduml
if "Page.onSecurityCheck" then
->[true] "Page.onInit()"
if "isForward?" then
->[no] "Process controls"
else
-->[yes] ===RENDERING===
endif
else
-->[false] ===REDIRECT_CHECK===
endif
--> "Page.onDestroy()"
-->(*)
@enduml
5.2 Start/Stop/End
You can use start and stop keywords to denote the beginning and the end of a diagram.
@startuml
start
:Hello world;
:This is defined on
several **lines**;
stop
@enduml
:This is defined on
several **lines**;
end
@enduml
5.3 Conditional
You can use if, then and else keywords to put tests in your diagram. Labels can be provided using parentheses.
The 3 syntaxes are possible:
• if (...) then (...)
@startuml
start
stop
@enduml
[Ref. QA-301]
You can use the elseif keyword to have several tests (by default, it is the horizontal mode):
@startuml
start
if (condition A) then (yes)
:Text 1;
elseif (condition B) then (yes)
:Text 2;
stop
elseif (condition C) then (yes)
:Text 3;
elseif (condition D) then (yes)
:Text 4;
else (nothing)
:Text else;
endif
stop
@enduml
You can use the command !pragma useVerticalIf on to have the tests in vertical mode:
@startuml
!pragma useVerticalIf on
start
if (condition A) then (yes)
:Text 1;
elseif (condition B) then (yes)
:Text 2;
stop
elseif (condition C) then (yes)
:Text 3;
elseif (condition D) then (yes)
:Text 4;
else (nothing)
:Text else;
endif
stop
@enduml
[Ref. QA-3931]
stop
endif
#palegreen:action;
@enduml
But if you want to stop at an precise action, you can use the kill or detach keyword:
• kill
@startuml
if (condition?) then
#pink:error;
kill
endif
#palegreen:action;
@enduml
[Ref. QA-265]
• detach
@startuml
if (condition?) then
#pink:error;
detach
endif
#palegreen:action;
@enduml
start
repeat
:read data;
:generate diagrams;
repeat while (more data?) is (yes)
->no;
stop
@enduml
It is also possible to use a full action as repeat target and insert an action in the return path using the backward
keyword.
@startuml
start
stop
@enduml
[Ref. QA-6105]
start
stop
@enduml
It is possible to provide a label after the endwhile keyword, or using the is keyword.
@startuml
while (check filesize ?) is (not empty)
:read file;
endwhile (empty)
:close file;
@enduml
start
@enduml
5.9 Notes
Text formatting can be done using creole wiki syntax.
A note can be floating, using floating keyword.
@startuml
start
:foo1;
floating note left: This is a note
:foo2;
note right
This note is on several
//lines// and can
contain <b>HTML</b>
====
* Calling the method ""foo()"" is prohibited
end note
stop
@enduml
[Ref. QA-11788]
5.10 Colors
You can specify a color for some activities.
@startuml
start
:starting progress;
#HotPink:reading configuration files
These files should be edited at this point!;
#AAAAAA:ending of the process;
@enduml
@startuml
skinparam ArrowHeadColor none
start
repeat :Enter data;
:Submit;
backward :Warning;
repeat while (Valid?) is (No) not (Yes)
stop
@enduml
5.12 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.
@startuml
:foo1;
-> You can put text on arrows;
if (test) then
-[#blue]->
:foo2;
-[#green,dashed]-> The text can
also be on several lines
and **very** long...;
:foo3;
else
-[#black,dotted]->
:foo4;
endif
-[#gray,bold]->
:foo5;
@enduml
5.13 Connector
You can use parentheses to denote connector.
@startuml
start
:Some activity;
(A)
detach
(A)
:Other activity;
@enduml
@enduml
[Ref. QA-10077]
5.15 Grouping
You can group activity together by defining partition:
@startuml
start
partition Initialization {
:read config file;
:init internal variable;
}
partition Running {
:wait for user interaction;
:print information;
}
stop
@enduml
5.16 Swimlanes
Using pipe |, you can define swimlanes.
It's also possible to change swimlanes color.
@startuml
|Swimlane1|
start
:foo1;
|#AntiqueWhite|Swimlane2|
:foo2;
:foo3;
|Swimlane1|
:foo4;
|Swimlane2|
:foo5;
stop
@enduml
• kill
@startuml
:start;
fork
:foo1;
:foo2;
fork again
:foo3;
kill
endfork
if (foo4) then
:foo5;
kill
endif
:foo6;
kill
:foo7;
stop
@enduml
split again
:bar\\
split again
:i > 5}
stop
end split
:finish;
@enduml
start
:ClickServlet.handleRequest();
:new page;
if (Page.onSecurityCheck) then (true)
:Page.onInit();
if (isForward?) then (no)
:Process controls;
if (continue processing?) then (no)
stop
endif
else (false)
endif
stop
@enduml
@startuml
skinparam conditionStyle inside
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
@startuml
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
@startuml
skinparam conditionStyle diamond
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
@startuml
skinparam conditionStyle InsideDiamond
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
@startuml
skinparam conditionStyle foo1
start
repeat
:act1;
:act2;
repeatwhile (<b>end)
:act3;
@enduml
@enduml
@enduml
[Ref. QA-4015]
6 Component Diagram
Let's have few examples :
6.1 Components
Components must be bracketed.
You can also use the component keyword to define a component. And you can define an alias, using the as
keyword. This alias will be used later, when defining relations.
@startuml
[First component]
[Another component] as Comp2
component Comp3
component [Last\ncomponent] as Comp4
@enduml
6.2 Interfaces
Interface can be defined using the () symbol (because this looks like a circle).
You can also use the interface keyword to define an interface. And you can define an alias, using the as keyword.
This alias will be used latter, when defining relations.
We will see latter that interface definition is optional.
@startuml
() "First Interface"
() "Another interface" as Interf2
interface Interf3
interface "Last\ninterface" as Interf4
[component]
footer //Adding "component" to force diagram to be a **component diagram**//
@enduml
@enduml
DA - [First Component]
[First Component] ..> HTTP : use
@enduml
cloud {
[Example 1]
}
database "MySql" {
folder "This is my folder" {
[Folder 3]
}
frame "Foo" {
[Frame 4]
}
}
@enduml
It is also possible to change arrow direction by adding left, right, up or down keywords inside the arrow:
@startuml
[Component] -left-> left
[Component] -right-> right
[Component] -up-> up
[Component] -down-> down
@enduml
You can shorten the arrow by using only the first character of the direction (for example, -d- instead of -down-)
or the two first characters (-do-).
Please note that you should not abuse this functionality : Graphviz gives usually good results without tweaking.
And with the left to right direction parameter:
@startuml
left to right direction
[Component] -left-> left
[Component] -right-> right
[Component] -up-> up
[Component] -down-> down
@enduml
@startuml
DA - [First Component]
[First Component] ..> HTTP : use
@enduml
DA - [First Component]
[First Component] ..> HTTP : use
@enduml
DA - [First Component]
[First Component] ..> HTTP : use
@enduml
FFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFF
}
6.13 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
You can define specific color and fonts for stereotyped components and interfaces.
@startuml
skinparam interface {
backgroundColor RosyBrown
borderColor orange
}
skinparam component {
FontSize 13
BackgroundColor<<Apache>> Red
BorderColor<<Apache>> #FF6655
FontName Courier
BorderColor black
BackgroundColor gold
ArrowFontName Impact
ArrowColor #FF6655
ArrowFontColor #777777
}
() "Data Access" as DA
DA - [First Component]
[First Component] ..> () HTTP : use
HTTP - [Web Server] << Apache >>
@enduml
@startuml
[AA] <<static lib>>
[BB] <<shared lib>>
[CC] <<static lib>>
node node1
node node2 <<shared node>>
database Production
skinparam component {
backgroundColor<<static lib>> DarkKhaki
backgroundColor<<shared lib>> Green
}
skinparam node {
borderColor Green
backgroundColor Yellow
backgroundColor<<shared node>> Magenta
}
skinparam databaseBackgroundColor Aqua
@enduml
7 State Diagram
State diagrams are used to give an abstract description of the behavior of a system. This behavior is represented as
a series of events that can occur in one or more possible states.
@enduml
@startuml
scale 350 width
[*] --> NotShooting
state NotShooting {
[*] --> Idle
Idle --> Configuring : EvConfig
Configuring --> Idle : EvConfig
}
state Configuring {
[*] --> NewValueSelection
NewValueSelection --> NewValuePreview : EvNewValue
NewValuePreview --> NewValueSelection : EvNewValueRejected
NewValuePreview --> NewValueSelection : EvNewValueSaved
state NewValuePreview {
State1 -> State2
}
}
@enduml
@startuml
state A {
state X {
}
state Y {
}
}
state B {
state Z {
}
}
X --> Z
Z --> Y
@enduml
[Ref. QA-3300]
@enduml
@enduml
@startuml
[*] --> Active
state Active {
[*] -> NumLockOff
NumLockOff --> NumLockOn : EvNumLockPressed
NumLockOn --> NumLockOff : EvNumLockPressed
--
[*] -> CapsLockOff
CapsLockOff --> CapsLockOn : EvCapsLockPressed
CapsLockOn --> CapsLockOff : EvCapsLockPressed
--
[*] -> ScrollLockOff
ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
}
@enduml
@startuml
[*] --> Active
state Active {
[*] -> NumLockOff
NumLockOff --> NumLockOn : EvNumLockPressed
NumLockOn --> NumLockOff : EvNumLockPressed
||
[*] -> CapsLockOff
CapsLockOff --> CapsLockOn : EvCapsLockPressed
CapsLockOn --> CapsLockOff : EvCapsLockPressed
||
[*] -> ScrollLockOff
ScrollLockOff --> ScrollLockOn : EvCapsLockPressed
ScrollLockOn --> ScrollLockOff : EvCapsLockPressed
}
@enduml
state c <<choice>>
@startuml
state Somp {
state entry1 <<entryPoint>>
state entry2 <<entryPoint>>
state sin
entry1 --> sin
entry2 -> sin
sin -> sin2
sin2 --> exitA <<exitPoint>>
}
[Ref. QA-4309]
[Ref. QA-4309]
@enduml
You can shorten the arrow definition by using only the first character of the direction (for example, -d- instead of
-down-) or the two first characters (-do-).
Please note that you should not abuse this functionality : Graphviz gives usually good results without tweaking.
X1 -[dashed]-> X2
Z1 -[dotted]-> Z2
Y1 -[#blue,bold]-> Y2
@enduml
7.15 Note
You can also define notes using note left of, note right of, note top of, note bottom of keywords.
You can also define notes on several lines.
@startuml
@enduml
state foo
note "This is a floating note" as N1
@enduml
@enduml
[Ref. QA-1812]
7.19 Skinparam
You can use the skinparam command to change colors and fonts for the drawing.
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
You can define specific color and fonts for stereotyped states.
@startuml
skinparam backgroundColor LightYellow
skinparam state {
StartColor MediumBlue
EndColor Red
BackgroundColor Peru
BackgroundColor<<Warning>> Olive
BorderColor Gray
FontName Impact
}
<style>
stateDiagram {
BackgroundColor Peru
'LineColor Gray
FontName Impact
FontColor Red
arrow {
FontSize 13
LineColor Blue
}
}
</style>
8 Object Diagram
object o2
diamond dia
object o3
o1 --> dia
o2 --> dia
dia --> o3
@enduml
object user
@enduml
object user {
name = "Dummy"
id = 123
}
@enduml
• Use packages
• Skin the output
@startuml
map "Map **Contry => CapitalCity**" as CC {
UK => London
USA => Washington
Germany => Berlin
}
@enduml
@startuml
map "map: Map<Integer, String>" as users {
1 => Alice
2 => Bob
3 => Charlie
}
@enduml
map CapitalCity {
UK *-> London
USA => Washington
Germany => Berlin
}
@enduml
@startuml
object London
object Washington
object Berlin
object NewYork
map CapitalCity {
UK *-> London
USA *--> Washington
Germany *---> Berlin
}
[Ref. #307]
9 Timing Diagram
This is still under construction. You can propose new features if you need some.
@0
WU is Idle
WB is Idle
@100
WU is Waiting
WB is Processing
@300
WB is Waiting
@enduml
@0
EN is low
@5
EN is high
@10
EN is low
@enduml
@0
WU is Idle
WB is Idle
@100
WU -> WB : URL
WU is Waiting
WB is Processing
@300
WB is Waiting
@enduml
@0
WU is Idle
WB is Idle
DNS is Idle
@+100
WU -> WB : URL
WU is Waiting
WB is Processing
@+200
WB is Waiting
WB -> DNS@+50 : Resolve URL
@+100
DNS is Processing
@+300
DNS is Idle
@enduml
@0 as :start
@5 as :en_high
@10 as :en_low
@:start
EN is low
db is "0x0000"
@:en_high
EN is high
@:en_low
EN is low
@:en_high-2
db is "0xf23a"
@:en_high+6
db is "0x0000"
@enduml
@WB
0 is idle
+200 is Proc.
+100 is Waiting
@WU
0 is Waiting
+500 is ok
@enduml
@WU
0 is Waiting
+500 is ok
@enduml
@startuml
robust "Web Browser" as WB
concise "Web User" as WU
WB is Initializing
WU is Absent
@WB
0 is idle
+200 is Processing
+100 is Waiting
@WU
0 is Waiting
+500 is ok
@enduml
@0
WU is {-}
@100
WU is A1
@200
WU is {-}
@300
WU is {hidden}
@400
WU is A3
@500
WU is {-}
@enduml
WU is Absent
@WU
0 is Waiting
+500 is ok
@enduml
@2019/07/02
WU is Idle
WB is Idle
@2019/07/04
WU is Waiting : some note
WB is Processing : some other note
@2019/07/05
WB is Waiting
@enduml
@startuml
robust "Web Browser" as WB
concise "Web User" as WU
@1:15:00
WU is Idle
WB is Idle
@1:16:30
WU is Waiting : some note
WB is Processing : some other note
@1:17:30
WB is Waiting
@enduml
WB is Initializing
WU is Absent
@WB
0 is idle
+200 is Processing
+100 is Waiting
WB@0 <-> @50 : {50 ms lag}
@WU
0 is Waiting
+500 is ok
@200 <-> @+150 : {150 ms}
@enduml
@0
WU is Idle
WB is Idle
@100
WU -> WB : URL
WU is Waiting #LightCyan;line:Aqua
@200
WB is Proc.
@300
WU -> WB@350 : URL2
WB is Waiting
@+200
WU is ok
@+200
WB is Idle
@0
WU is Idle
WB is Idle
@100
WU is Waiting
WB is Processing
@300
WB is Waiting
@enduml
Server is idle
Client is idle
@Client
0 is send
Client -> Server@+25 : GET
+25 is await
+75 is recv
+25 is idle
+25 is send
Client -> Server@+25 : GET\nIf-Modified-Since: 150
+25 is await
+50 is recv
+25 is idle
@100 <-> @275 : no need to re-request from server
@Server
25 is recv
+25 is work
+25 is send
Server -> Client@+25 : 200 OK\nExpires: 275
+25 is idle
+75 is recv
+25 is send
Server -> Client@+25 : 304 Not Modified
+25 is idle
@Cache
75 is fresh
+200 is stale
@enduml
@6 as :write_beg
@10 as :write_end
@15 as :read_beg
@19 as :read_end
@0
en is low
db is "0x0"
addr is "0x03f"
rw is low
dv is 0
@:write_beg-3
en is high
@:write_beg-2
db is "0xDEADBEEF"
@:write_beg-1
dv is 1
@:write_beg
rw is high
@:write_end
rw is low
dv is low
@:write_end+1
rw is low
db is "0x0"
addr is "0x23"
@12
dv is high
@13
db is "0xFFFF"
@20
en is low
dv is low
@21
db is "0x0"
10 Gantt Diagram
The Gantt is described in natural language, using very simple sentences (subject-verb-complement).
10.1.1 Duration
10.1.2 Start
10.1.3 End
@startuml
[Prototype design] lasts 15 days
[Test prototype] lasts 10 days
@enduml
10.1.4 Start/End
@enduml
@startgantt
[Prototype design] lasts 15 days
[Test prototype] lasts 10 days
[Test prototype] starts at [Prototype design]'s end
@endgantt
@startgantt
[Prototype design] lasts 10 days
[Code prototype] lasts 10 days
[Write tests] lasts 5 days
[Code prototype] starts at [Prototype design]'s end
[Write tests] starts at [Code prototype]'s start
@endgantt
@startgantt
[foo] lasts 21 days
[foo] is 40% completed
[bar] lasts 30 days and is 10% complete
@endgantt
10.7 Milestone
You can define Milestones using the happen verb.
@startgantt
[Test prototype] lasts 10 days
[Prototype completed] happens at [Test prototype]'s end
[Setup assembly line] lasts 12 days
[Setup assembly line] starts at [Test prototype]'s end
@endgantt
@startgantt
Project starts 2020-07-01
[Test prototype] lasts 10 days
[Prototype completed] happens 2020-07-10
[Setup assembly line] lasts 12 days
[Setup assembly line] starts at [Test prototype]'s end
@endgantt
@startgantt
[Task1] lasts 4 days
then [Task1.1] lasts 4 days
[Task1.2] starts at [Task1]'s end and lasts 7 days
@endgantt
[Ref. QA-10764]
10.8 Hyperlinks
You can add hyperlinks to tasks.
@startgantt
[task1] lasts 10 days
[task1] links to [[http://plantuml.com]]
@endgantt
10.9 Calendar
You can specify a starting date for the whole project. By default, the first task starts at this date.
@startgantt
Project starts the 20th of september 2017
[Prototype design] as [TASK1] lasts 13 days
[TASK1] is colored in Lavender/LightBlue
@endgantt
@startuml
saturday are closed
sunday are closed
10.11.2 Weekly
@startuml
printscale weekly
saturday are closed
sunday are closed
[TASK1]->[Testing]
@startgantt
printscale weekly
Project starts the 20th of september 2020
[Prototype design] as [TASK1] lasts 130 days
[TASK1] is colored in Lavender/LightBlue
[Testing] lasts 20 days
[TASK1]->[Testing]
10.11.3 Monthly
@startgantt
projectscale monthly
Project starts the 20th of september 2020
[Prototype design] as [TASK1] lasts 130 days
[TASK1] is colored in Lavender/LightBlue
[Testing] lasts 20 days
[TASK1]->[Testing]
10.14 Separator
You can use -- to separate sets of tasks.
@startgantt
[Task1] lasts 10 days
then [Task2] lasts 4 days
-- Phase Two --
then [Task3] lasts 5 days
then [Task4] lasts 6 days
@endgantt
10.17 Comments
As is mentioned on Common Commands page: �blockquote�� Everything that starts with simple quote ' is
a comment.
You can also put comments on several lines using /' to start and '/ to end. �blockquote�� (i.e.: the first character
(except space character) of a comment line must be a simple quote ')
@startgantt
' This is a comment
FontName Helvetica
FontColor red
FontSize 18
FontStyle bold
BackGroundColor GreenYellow
LineColor blue
}
milestone {
FontColor blue
FontSize 25
FontStyle italic
BackGroundColor yellow
LineColor red
}
note {
FontColor DarkGreen
FontSize 10
LineColor OrangeRed
}
}
</style>
[Task1] lasts 20 days
note bottom
memo1 ...
memo2 ...
explanations1 ...
explanations2 ...
end note
[Task2] lasts 4 days
[Task1] -> [Task2]
-- Separator title --
[M1] happens on 5 days after [Task1]'s end
-- end --
@enduml
@endgantt
@endgantt
@startgantt
-- test01 --
TODO: DONE Thanks for correction (of #386 on v1.2020.18) when overlapping
@startgantt
-- separator --
@startuml
Links are colored in blue
[Prototype design] lasts 14 days
[Build prototype] lasts 4 days
[Prepare test] lasts 6 days
[Prototype design] -[#FF00FF]-> [Build prototype]
[Prototype design] -[dotted]-> [Prepare test]
@enduml
@endgantt
title My title
legend
The legend
end legend
@enduml
hide footbox
title Foot Box removed
• daily scale
@startgantt
hide footbox
@endgantt
• weekly scale
@startgantt
hide footbox
printscale weekly
saturday are closed
sunday are closed
• monthly scale
@startgantt
hide footbox
projectscale monthly
Project starts the 20th of september 2020
[Prototype design] as [TASK1] lasts 130 days
[TASK1] is colored in Lavender/LightBlue
[Testing] lasts 20 days
[TASK1]->[Testing]
11 MindMap
MindMap diagram are still in beta: the syntax may change without notice.
11.2 Multilines
You can use : and ; to have multilines box.
@startmindmap
* Class Templates
**:Example 1
<code>
template <typename T>
class cname{
void f1()<U+003B>
...
}
</code>
;
**:Example 2
<code>
other template <typename T>
class cname{
...
</code>
;
@endmindmap
11.3 Colors
It is possible to change node color.
.your_style_name {
BackgroundColor lightblue
}
}
</style>
* root node
* some first level node <<green>>
* second level node <<rose>>
* another second level node <<your_style_name>>
* another first level node <<green>>
@endmindmap
++ LMDE
++ SolydXK
++ SteamOS
++ Raspbian
-- Windows 95
-- Windows 98
-- Windows NT
--- Windows 8
--- Windows 10
@endmindmap
mindmapDiagram {
node {
BackgroundColor lightGreen
}
:depth(1) {
BackGroundColor white
}
}
</style>
* Linux
** NixOS
** Debian
*** Ubuntu
**** Linux Mint
**** Kubuntu
**** Lubuntu
**** KDE Neon
@endmindmap
left side
** A
*** AA
*** AB
** B
@endmindmap
* <&flag>Debian
** <&globe>Ubuntu
*** Linux Mint
*** Kubuntu
*** Lubuntu
*** KDE Neon
** <&graph>LMDE
** <&pulse>SolydXK
** <&people>SteamOS
** <&star>Raspbian with a very long name
*** <s>Raspmbc</s> => OSMC
*** <s>Raspyfi</s> => Volumio
header
My super header
endheader
legend right
Short
legend
endlegend
@endmindmap
<style>
node {
Padding 12
Margin 3
HorizontalAlignment center
LineColor blue
LineThickness 3.0
BackgroundColor gold
RoundCorner 40
MaximumWidth 100
}
rootNode {
LineStyle 8.0;3.0
LineColor red
BackgroundColor white
LineThickness 1.0
RoundCorner 0
Shadowing 0.0
}
leafNode {
LineColor gold
RoundCorner 0
Padding 3
}
arrow {
LineStyle 4
LineThickness 0.5
LineColor green
}
</style>
* Hi =)
** sometimes i have node in wich i want to write a long text
*** this results in really huge diagram
**** of course, i can explicit split with a\nnew line
**** but it could be cool if PlantUML was able to split long lines, maybe with an option who specify the max
@endmindmap
LineThickness 2.5
}
}
}
</style>
* World
** America
*** Canada
*** Mexico
**** Chihuahua
*** USA
**** Texas
***< New York
** Europe
*** England
*** Germany
*** Spain
@endwbs
<style>
node {
Padding 12
Margin 3
HorizontalAlignment center
LineColor blue
LineThickness 3.0
BackgroundColor gold
RoundCorner 40
MaximumWidth 100
}
rootNode {
LineStyle 8.0;3.0
LineColor red
BackgroundColor white
LineThickness 1.0
RoundCorner 0
Shadowing 0.0
}
leafNode {
LineColor gold
RoundCorner 0
Padding 3
}
arrow {
LineStyle 4
LineThickness 0.5
LineColor green
}
</style>
* Hi =)
** sometimes i have node in wich i want to write a long text
*** this results in really huge diagram
**** of course, i can explicit split with a\nnew line
**** but it could be cool if PlantUML was able to split long lines, maybe with an option who specify the max
@endwbs
@startjson
{
"null": null,
"true": true,
"false": false,
"JSON_Number": [-1, -1.1, "<color:green>TBC"],
"JSON_String": "a\nb\rc\td <color:green>TBC...",
"JSON_Object": {
"{}": {},
"k_int": 123,
"k_str": "abc",
"k_obj": {"k": "v"}
},
"JSON_Array" : [
[],
[true, false],
[-1, 1],
["a", "b", "c"],
["mix", null, true, 1, {"k": "v"}]
]
}
@endjson
@startjson
{
"Numeric": [1, 2, 3],
"String ": ["v1a", "v2b", "v3c"],
"Boolean": [true, false, true]
}
@endjson
13.4.3 Number
@startjson
[1, 2, 3]
@endjson
13.4.4 String
@startjson
["1a", "2b", "3c"]
@endjson
13.4.5 Boolean
@startjson
[true, false, true]
@endjson
On JSON you can use Unicode directly or by using escaped form like .
@startjson
{
"<color:blue><b>code": "<color:blue><b>value",
"a\\u005Cb": "a\u005Cb",
"\\uD83D\\uDE10": "\uD83D\uDE10",
"�": "�"
}
@endjson
@startjson
{
"**legend**: character name": ["**two-character escape sequence**", "example (beetwen 'a' and
"quotation mark character (U+0022)": ["\\\"", "a\"b"],
"reverse solidus character (U+005C)": ["\\\\", "a\\b"],
"solidus character (U+002F)": ["\\\/", "a\/b"],
"backspace character (U+0008)": ["\\b", "a\bb"],
TODO: FIXME FIXME or not �, on the same item as management in PlantUML � TODO: FIXME
@startjson
[
"\\\\",
"\\n",
"\\r",
"\\t"
]
@endjson
"Hello world!"
@endjson
@startjson
42
@endjson
@startjson
true
@endjson
14 Maths
You can use AsciiMath or JLaTeXMath notation within PlantUML:
@startuml
:<math>int_0^1f(x)dx</math>;
:<math>x^2+y_1+z_12^34</math>;
note right
Try also
<math>d/dxf(x)=lim_(h->0)(f(x+h)-f(x))/h</math>
<latex>P(y|\mathbf{x}) \mbox{ or } f(\mathbf{x})+\epsilon</latex>
end note
@enduml
or:
@startuml
Bob -> Alice : Can you solve: <math>ax^2+bx+c=0</math>
Alice --> Bob: <math>x = (-b+-sqrt(b^2-4ac))/(2a)</math>
@enduml
15 Common commands
15.1 Comments
Everything that starts with simple quote ' is a comment.
You can also put comments on several lines using /' to start and '/ to end.
header
<font color=red>Warning:</font>
Do not use in production.
endheader
@enduml
15.3 Zoom
You can use the scale command to zoom the generated image.
You can use either a number or a fraction to define the scale factor. You can also specify either width or height (in
pixel). And you can also give both width and height : the image is scaled to fit inside the specified dimension.
• scale 1.5
• scale 2/3
• scale 200 width
• scale 200 height
• scale 200*100
• scale max 300*200
• scale max 1024 width
• scale max 800 height
@startuml
scale 180*90
Bob->Alice : hello
@enduml
15.4 Title
The title keywords is used to put a title. You can add newline using in the title description.
Some skinparam settings are available to put borders on the title.
@startuml
skinparam titleBorderRoundCorner 15
skinparam titleBorderThickness 2
skinparam titleBorderColor red
skinparam titleBackgroundColor Aqua-CadetBlue
@enduml
title
<u>Simple</u> communication example
on <i>several</i> lines and using <back:cadetblue>creole tags</back>
end title
@enduml
15.5 Caption
There is also a caption keyword to put a caption under the diagram.
@startuml
caption figure 1
Alice -> Bob: Hello
@enduml
@startuml
Alice -> Bob : Hello
legend top left
Short
legend
endlegend
@enduml
@startuml
header some header
title My title
legend
The legend
end legend
start
:Hello world;
:This is defined on
several **lines**;
stop
@enduml
15.7.2 Archimate
@startuml
header some header
title My title
legend
The legend
end legend
rectangle GO #lightgreen
rectangle STOP #red
rectangle WAIT #orange
@enduml
15.7.3 Class
@startuml
header some header
title My title
legend
The legend
end legend
a -- b
@enduml
@startuml
header some header
title My title
legend
The legend
end legend
node n
(u) -> [c]
@enduml
@startuml
header some header
title My title
legend
The legend
end legend
@enduml
15.7.6 Object
@startuml
header some header
title My title
legend
The legend
end legend
object user {
name = "Dummy"
id = 123
}
@enduml
15.7.7 MindMap
@startmindmap
header some header
title My title
legend
The legend
end legend
* r
** d1
** d2
@endmindmap
@startuml
header some header
title My title
legend
The legend
end legend
nwdiag {
network inet {
web01 [shape = cloud]
}
}
@enduml
15.7.9 Sequence
@startuml
header some header
title My title
legend
The legend
end legend
a->b
@enduml
15.7.10 State
@startuml
header some header
title My title
legend
The legend
end legend
@enduml
15.7.11 Timing
@startuml
header some header
title My title
legend
The legend
end legend
@0
WU is Idle
WB is Idle
@100
WU is Waiting
WB is Processing
@300
WB is Waiting
@enduml
@startwbs
header some header
title My title
legend
The legend
end legend
* r
** d1
** d2
@endwbs
@startsalt
header some header
title My title
legend
The legend
end legend
{+
Login | "MyName "
Password | "**** "
[Cancel] | [ OK ]
}
@endsalt
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
15.8.1 Activity
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
start
:Hello world;
:This is defined on
several **lines**;
stop
@enduml
15.8.2 Archimate
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
rectangle GO #lightgreen
rectangle STOP #red
rectangle WAIT #orange
@enduml
15.8.3 Class
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
a -- b
@enduml
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
node n
(u) -> [c]
@enduml
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
@enduml
15.8.6 Object
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
object user {
name = "Dummy"
id = 123
}
@enduml
15.8.7 MindMap
@startmindmap
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
* r
** d1
** d2
@endmindmap
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
nwdiag {
network inet {
web01 [shape = cloud]
}
}
@enduml
15.8.9 Sequence
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
a->b
@enduml
15.8.10 State
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
@enduml
15.8.11 Timing
@startuml
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
@0
WU is Idle
WB is Idle
@100
WU is Waiting
WB is Processing
@300
WB is Waiting
@enduml
@startwbs
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
}
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
header some header
title My title
legend
The legend
end legend
* r
** d1
** d2
@endwbs
TODO: FIXME Fix all (title, caption, legend, header, footer) for salt. TODO: FIXME
@startsalt
<style>
title {
HorizontalAlignment right
FontSize 24
FontColor blue
}
header {
HorizontalAlignment center
FontSize 26
FontColor purple
footer {
HorizontalAlignment left
FontSize 28
FontColor red
}
legend {
FontSize 30
BackGroundColor yellow
Margin 30
Padding 50
}
caption {
FontSize 32
}
</style>
@startsalt
header some header
title My title
legend
The legend
end legend
{+
Login | "MyName "
Password | "**** "
[Cancel] | [ OK ]
}
@endsalt
16 Salt (Wireframe)
Salt is a subproject included in PlantUML that may help you to design graphical interface or Website Wireframe or
Page Schematic or Screen Blueprint.
The goal of this tool is to discuss about simple and sample windows.
You can use either @startsalt keyword, or @startuml followed by a line with salt keyword.
Just after the opening bracket, you can use a character to define if you want to draw lines or columns of the grid :
Symbol Result
# To display all vertical and horizontal lines
! To display all vertical lines
- To display all horizontal lines
+ To display external lines
@startsalt
{+
Login | "MyName "
Password | "**** "
[Cancel] | [ OK ]
}
@endsalt
[Ref. QA-5840]
[Ref. QA-1265]
@startsalt
{+
{* File | Edit | Source | Refactor
Refactor | New | Open File | - | Close | Close All }
{/ General | Fullscreen | Behavior | Saving }
{
{ Open image in: | ^Smart Mode^ }
[X] Smooth images when zoomed
[X] Confirm image deletion
[ ] Show hidden images
}
[Close]
}
@endsalt
16.12 Colors
It is possible to change text color of widget.
@startsalt
{
<color:Blue>Just plain text
[This is my default button]
[<color:green>This is my green button]
[<color:#9a9a9a>This is my disabled button]
[] <color:red>Unchecked box
[X] <color:green>Checked box
"Enter text here "
^This is a droplist^
^<color:#9a9a9a>This is a disabled droplist^
^<color:red>This is a red droplist^
}
@endsalt
[Ref. QA-12177]
[Ref. QA-5849]
16.14 OpenIconic
OpenIconic is a very nice open source icon set. Those icons have been integrated into the creole parser, so you can
use them out-of-the-box. You can use the following syntax: <&ICON_NAME>.
@startsalt
{
Login<&person> | "MyName "
Password<&key> | "**** "
[Cancel <&circle-x>] | [OK <&account-login>]
}
@endsalt
The complete list is available on OpenIconic Website, or you can use the following special diagram:
@startuml
listopeniconic
@enduml
{+
<b>please wait
operation in progress
<&clock>
[cancel]
}
}}
" as wait
wait -right-> "
{{
salt
{+
<b>success
congratulations!
[ok]
}
}}
" as success
!procedure _choose()
{+
<b>an example
choose one option
()one
()two
[ok]
}
!endprocedure
!procedure _wait()
{+
<b>please wait
operation in progress
<&clock>
[cancel]
}
!endprocedure
!procedure _success()
{+
<b>success
congratulations!
[ok]
}
!endprocedure
!procedure _error()
{+
<b>error
failed, sorry
[ok]
}
!endprocedure
[Ref. QA-8547]
17 Creole
A light Creole engine has been integrated into PlantUML to have a standardized way of defining text style.
All diagrams are now supporting this syntax.
Note that ascending compatibility with HTML syntax is preserved.
17.2 List
@startuml
object demo {
* Bullet list
* Second item
}
note left
* Bullet list
* Second item
** Sub item
end note
legend
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item
end legend
@enduml
@enduml
17.5 Headings
@startuml
usecase UC1 as "
= Extra-large heading
Some text
== Large heading
Other text
=== Medium heading
Information
....
==== Small heading"
@enduml
17.7 Code
You can use <code> if you put some language code in your diagram.
@startuml
Alice -> Bob : hello
note right
<code>
main() {
printf("Hello world");
}
</code>
end note
@enduml
@startuml
Alice -> Bob : hello
note left
<code>
This is **bold**
This is //italics//
This is ""monospaced""
This is --stroked--
This is __underlined__
This is ~~waved~~
--other test--
This is <U+221E> long
17.8 Table
17.8.1 Build a table
You can also specify background colors and colors for border.
@startuml
title
<#lightblue,#red>|= Step |= Date |= Name |= Status |= Link |
<#lightgreen>| 1.1 | TBD | plantuml news |<#Navy><color:OrangeRed><b> Unknown | [[https://plantuml.co
end title
@enduml
[Ref. QA-7184]
You can also set the border color to the same color as the background.
@startuml
node n
note right of n
<#FBFB77,#FBFB77>|= Husky / Yorkie |= Foo |
| SourceTree1 | foo1 |
| ST2 | foo2 |
end note
@enduml
[Ref. QA-12448]
note as deepCSS1
|= <#white> Husky / Yorkie |= Foo |
|<#gainsboro><r> SourceTree1 | foo1 |
endnote
note as deepCSS2
|= Husky / Yorkie |
|<#gainsboro> SourceTree2 |
endnote
note as deepCSS3
<#white>|= Husky / Yorkie |= Foo |
|<#gainsboro> SourceTree1 | foo1 |
endnote
@enduml
[Ref. QA-10923]
17.9 Tree
You can use |_ characters to build a tree.
On common commands, like title:
@startuml
skinparam titleFontSize 14
title
Example of Tree
|_ First line
|_ **Bom(Model)**
|_ prop1
|_ prop2
|_ prop3
|_ Last line
end title
[*] --> State1
@enduml
On Class diagram:
@startuml
class Foo{
**Bar(Model)**
|_ prop
|_ **Bom(Model)**
|_ prop2
|_ prop3
|_ prop3.1
|_ prop4 :(
--
}
@enduml
[Ref. QA-3448]
And on component or deployement diagram:
@startuml
[A] as A
rectangle "Box B" {
component B [
Level 1
|_ Level 2a
|_ Level 3a
|_ Level 3b
|_ Level 3c
|_ Level 4a
|_ Level 3d
|_ Level 2b
|_ Level 3e
]
}
A -> B
@enduml
[Ref. QA-11365]
17.11 OpenIconic
OpenIconic is an very nice open source icon set. Those icons have been integrated into the creole parser, so you
can use them out-of-the-box.
You can use the following syntax: <&ICON_NAME>.
@startuml
title: <size:20><&heart>Use of OpenIconic<&heart></size>
class Wifi
note left
Click on <&wifi>
end note
@enduml
The complete list is available on OpenIconic Website, or you can use the following special diagram:
@startuml
listopeniconic
@enduml
@startuml
start
:**test list 1**
* Bullet list
* Second item
** Sub item
*** Sub sub item
* Third item
----
**test list 2**
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item;
stop
@enduml
17.12.2 Class
TODO: FIXME �
• Sub item
• Sub sub item
TODO: FIXME
@startuml
class a {
**test list 1**
* Bullet list
* Second item
** Sub item
*** Sub sub item
* Third item
----
**test list 2**
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item
}
a -- b
@enduml
@startuml
node n [
**test list 1**
* Bullet list
* Second item
** Sub item
*** Sub sub item
* Third item
----
**test list 2**
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item
]
file f as "
**test list 1**
* Bullet list
* Second item
** Sub item
*** Sub sub item
* Third item
----
**test list 2**
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item
"
@enduml
N/A
17.12.5 Object
TODO: FIXME �
• Sub item
• Sub sub item
TODO: FIXME
@startuml
object user {
**test list 1**
* Bullet list
* Second item
** Sub item
*** Sub sub item
* Third item
----
**test list 2**
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item
}
@enduml
17.12.6 MindMap
@startmindmap
* root
** d1
**:**test list 1**
* Bullet list
* Second item
** Sub item
*** Sub sub item
* Third item
----
**test list 2**
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item;
@endmindmap
N/A
17.12.8 Note
@startuml
note as n
**test list 1**
* Bullet list
* Second item
** Sub item
*** Sub sub item
* Third item
----
**test list 2**
# Numbered list
# Second item
## Sub item
## Another sub item
# Third item
end note
@enduml
17.12.9 Sequence
17.12.10 State
17.13.2 Class
@startuml
class a {
You can have horizontal line
----
Or double line
====
Or strong line
____
Or dotted line
..My title..
//and title... //
==Title==
--Another title--
Enjoy!
}
a -- b
@enduml
@startuml
node n [
You can have horizontal line
----
Or double line
====
Or strong line
____
Or dotted line
..My title..
//and title... //
==Title==
--Another title--
Enjoy!
]
file f as "
You can have horizontal line
----
Or double line
====
Or strong line
____
Or dotted line
..My title..
//and title... //
==Title==
--Another title--
Enjoy!
"
@enduml
N/A
17.13.5 Object
@startuml
object user {
You can have horizontal line
----
Or double line
====
Or strong line
____
Or dotted line
..My title..
//and title... //
==Title==
--Another title--
Enjoy!
}
@enduml
17.13.6 MindMap
* root
** d1
**:You can have horizontal line
----
Or double line
====
Or strong line
____
Or dotted line
..My title..
//and title... //
==Title==
--Another title--
Enjoy!;
@endmindmap
N/A
17.13.8 Note
@startuml
note as n
You can have horizontal line
----
Or double line
====
Or strong line
____
Or dotted line
..My title..
//and title... //
==Title==
--Another title--
Enjoy!
end note
@enduml
17.13.9 Sequence
17.13.10 State
18.4 Examples
@startuml
sprite $printer [15x15/8z] NOtH3W0W208HxFz_kMAhj7lHWpa1XC716sz0Pq4MVPEWfBHIuxP3L6kbTcizR8tAhzaqFvXwvFf
start
:click on <$printer> to print the page;
@enduml
@startuml
sprite $bug [15x15/16z] PKzR2i0m2BFMi15p__FEjQEqB1z27aeqCqixa8S4OT7C53cKpsHpaYPDJY_12MHM-BLRyywPhrrlw
sprite $printer [15x15/8z] NOtH3W0W208HxFz_kMAhj7lHWpa1XC716sz0Pq4MVPEWfBHIuxP3L6kbTcizR8tAhzaqFvXwvF
sprite $disk {
444445566677881
436000000009991
43600000000ACA1
53700000001A7A1
53700000012B8A1
53800000123B8A1
63800001233C9A1
634999AABBC99B1
744566778899AB1
7456AAAAA99AAB1
8566AFC228AABB1
8567AC8118BBBB1
867BD4433BBBBB1
39AAAAABBBBBBC1
}
class Example {
Can have some bug : <$bug>
Click on <$disk> to save
}
@enduml
18.5 StdLib
The PlantUML StdLib includes a number of ready icons in various IT areas such as architecture, cloud services,
logos etc. It including AWS, Azure, Kubernetes, C4, product Logos and many others. To explore these libraries:
• Browse the Github folders of PlantUML StdLib
• Browse the source repos of StdLib collections that interest you. Eg if you are interested in logos you can find
that it came from gilbarbara-plantuml-sprites, and quickly find its
sprites-list. (The next section shows how to list selected sprites but unfortunately that's in grayscale whereas this
custom listing is in color.)
• Study the in-depth Hitchhiker’s Guide to PlantUML, eg sections Standard Library Sprites and PlantUML
Stdlib Overview
listsprites
@enduml
Most collections have files called all that allow you to see a whole sub-collection at once. Else you need to find
the sprites that interest you and include them one by one. Unfortunately, the version of a collection included in
StdLib often does not have such all files, so as you see above we include the collection from github, not from
StdLib.
All sprites are in grayscale, but most collections define specific macros that include appropriate (vendor-specific)
colors.
19 Skinparam command
You can change colors and font of the drawing using the skinparam command.
Example:
skinparam backgroundColor transparent
19.1 Usage
You can use this command :
• In the diagram definition, like any other commands,
• In an included file,
• In a configuration file, provided in the command line or the ANT task.
19.2 Nested
To avoid repetition, it is possible to nest definition. So the following definition :
skinparam xxxxParam1 value1
skinparam xxxxParam2 value2
skinparam xxxxParam3 value3
skinparam xxxxParam4 value4
is strictly equivalent to:
skinparam xxxx {
Param1 value1
Param2 value2
Param3 value3
Param4 value4
}
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
deactivate B
@enduml
19.4 Shadowing
You can disable the shadowing using the skinparam shadowing false command.
@startuml
actor User
(Glowing use case) <<with_shadow>> as guc
(Flat use case) <<no_shadow>> as fuc
User -- guc
User -- fuc
@enduml
@startuml
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
@enduml
19.6 Colors
You can use either standard color name or RGB code.
@startuml
colors
@enduml
19.9 Examples
@startuml
skinparam backgroundColor #EEEBDC
skinparam handwritten true
skinparam sequence {
ArrowColor DeepSkyBlue
ActorBorderColor DeepSkyBlue
LifeLineBorderColor blue
LifeLineBackgroundColor #A9DCDF
ParticipantBorderColor DeepSkyBlue
ParticipantBackgroundColor DodgerBlue
ParticipantFontName Impact
ParticipantFontSize 17
ParticipantFontColor #A9DCDF
ActorBackgroundColor aqua
ActorFontColor DeepSkyBlue
ActorFontSize 17
ActorFontName Aapex
}
actor User
participant "First Class" as A
participant "Second Class" as B
participant "Last Class" as C
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
@startuml
skinparam handwritten true
skinparam actor {
BorderColor black
FontName Courier
BackgroundColor<< Human >> Gold
}
skinparam usecase {
BackgroundColor DarkSeaGreen
BorderColor DarkSlateGray
ArrowColor Olive
}
@startuml
skinparam roundcorner 20
skinparam class {
BackgroundColor PaleGreen
ArrowColor SeaGreen
BorderColor SpringGreen
}
skinparam stereotypeCBackgroundColor YellowGreen
@startuml
skinparam interface {
backgroundColor RosyBrown
borderColor orange
}
skinparam component {
FontSize 13
BackgroundColor<<Apache>> LightCoral
BorderColor<<Apache>> #FF6655
FontName Courier
BorderColor black
BackgroundColor gold
ArrowFontName Impact
ArrowColor #FF6655
ArrowFontColor #777777
}
() "Data Access" as DA
[Web Server] << Apache >>
DA - [First Component]
[First Component] ..> () HTTP : use
@startuml
[AA] <<static lib>>
[BB] <<shared lib>>
[CC] <<static lib>>
node node1
node node2 <<shared node>>
database Production
skinparam component {
backgroundColor<<static lib>> DarkKhaki
backgroundColor<<shared lib>> Green
}
skinparam node {
borderColor Green
backgroundColor Yellow
backgroundColor<<shared node>> Magenta
}
skinparam databaseBackgroundColor Aqua
@enduml
You can also view each skinparam parameters with its results displayed at https://plantuml-documentation.readthedocs.io/en/latest/form
skin-params.html.
20 Preprocessing
Some preprocessing capabilities are included in PlantUML, and available for all diagrams.
Those functionalities are very similar to the C language preprocessor, except that the special character # has been
changed to the exclamation mark !.
There is not real boolean type, but PlantUML use this integer convention:
• Integer 0 means false
• and any non-null number (as 1) or any string (as "1", or even "0") means true.
[Ref. QA-9702]
start
$foo(2)
end
@enduml
!procedure $init_class($name)
class $name {
$addCommonMethod()
}
!endprocedure
!procedure $addCommonMethod()
toString()
hashCode()
!endprocedure
$init_class("foo1")
$init_class("foo2")
$msg("foo1", "foo2")
@enduml
Variables defined in procedures are local. It means that the variable is destroyed when the procedure ends.
!endfunction
As in procedure (void function), variable are local by default (they are destroyed when the function is exited).
However, you can access to global variables from function. However, you can use the local keyword to create a
local variable if ever a global variable exists with the same name.
@startuml
!function $dummy()
!local $ijk = "local"
!return "Alice -> Bob : " + $ijk
!endfunction
@startuml
!function $inc($value, $step=1)
!return $value + $step
!endfunction
Only arguments at the end of the parameter list can have default values.
@startuml
!procedure defaulttest($x, $y="DefaultY", $z="DefaultZ")
note over Alice
x = $x
y = $y
z = $z
end note
!endprocedure
defaulttest(1, 2, 3)
defaulttest(1, 2)
defaulttest(1)
@enduml
$description"
!endprocedure
interface List
List : int size()
List : void clear()
List <|.. ArrayList
@enduml
File List.iuml
interface List
List : int size()
List : void clear()
The file List.iuml can be included in many diagrams, and any modification in this file will change all diagrams
that include it.
You can also put several @startuml/@enduml text block in an included file and then specify which block you
want to include adding !0 where 0 is the block number. The !0 notation denotes the first diagram.
For example, if you use !include foo.txt!1, the second @startuml/@enduml block within foo.txt will be
included.
You can also put an id to some @startuml/@enduml text block in an included file using @startuml(id=MY_OWN_ID)
syntax and then include the block adding !MY_OWN_ID when including the file, so using something like !include
foo.txt!MY_OWN_ID.
By default, a file can only be included once. You can use !include_many instead of !include if you want to
include some file several times. Note that there is also a !include_once directive that raises an error if a file is
included several times.
A -> A : stuff1
!startsub BASIC
B -> B : stuff2
!endsub
C -> C : stuff3
!startsub BASIC
D -> D : stuff4
!endsub
@enduml
file1.puml would be rendered exactly as if it were:
@startuml
A -> A : stuff1
B -> B : stuff2
C -> C : stuff3
D -> D : stuff4
@enduml
However, this would also allow you to have another file2.puml like this:
file2.puml
@startuml
@enduml
!import /path/to/customLibrary.zip
' This just adds "customLibrary.zip" in the search path
!include myFolder/myFile.iuml
' Assuming that myFolder/myFile.iuml is located somewhere
' either inside "customLibrary.zip" or on the local filesystem
...
COMP_TEXTGENCOMP(dummy)
@enduml
!$wrapper = "$go"
%invoke_procedure($wrapper)
@enduml
@startuml
!procedure $go($txt)
Bob -> Alice : $txt
!endprocedure
For return functions, you can use the corresponding special function %call_user_func() :
@startuml
!function bold($text)
!return "<b>"+ $text +"</b>"
!endfunction
21 Unicode
The PlantUML language use letters to define actor, usecase and soon.
But letters are not only A-Z latin characters, it could be any kind of letter from any language.
21.1 Examples
@startuml
skinparam handwritten true
skinparam backgroundColor #EEEBDC
actor 使用者
participant "頭等艙" as A
participant "第二類" as B
participant "最後一堂課" as 別的東西
A -> B: 創建請求
activate B
B --> A: 請求創建
deactivate B
A --> 使用者: 做完
deactivate A
@enduml
@startuml
--> 鞠躬向公眾
--> === S2 ===
--> 這傢伙波武器
--> (*)
@startuml
@startuml
() "Σωκράτηςψεύτης" as Σωκράτης
Σωκράτης - [Πτηνά πολεμοχαρής]
[Πτηνά πολεμοχαρής] ..> () Αθήνα : Αυτές οι φράσειςσημαίνουν τίποτα
@enduml
21.2 Charset
The default charset used when reading the text files containing the UML text description is system dependent.
Normally, it should just be fine, but in some case, you may want to the use another charset. For example, with the
command line:
java -jar plantuml.jar -charset UTF-8 files.txt
Or, with the ant task:
<!-- Put images in c:/images directory -->
<target name="main">
<plantuml dir="./src" charset="UTF-8" />
Depending of your Java installation, the following charset should be available: ISO-8859-1, UTF-8, UTF-16BE,
UTF-16LE, UTF-16.
22 Standard Library
This page explains the official Standard Library for PlantUML This Standard Library is now included in official re-
leases of PlantUML. Including files follows the C convention for "C standard library" (see https://en.wikipedia.org/wiki/C_standard_li
)
Contents of the library come from third party contributors. We thank them for their useful contribution!
!include <awslib/AWSCommon>
!include <awslib/General/Users>
!include <awslib/Mobile/APIGateway>
!include <awslib/SecurityIdentityAndCompliance/Cognito>
!include <awslib/Compute/Lambda>
!include <awslib/Database/DynamoDB>
You may also include the common.puml file, eg: !include <aws/common>, which contains helper macros de-
fined. With the common.puml imported, you can use the NAME_OF_SPRITE(parameters...) macro.
Example of usage:
@startuml
!include <aws/common>
!include <aws/Storage/AmazonS3/AmazonS3>
!include <aws/Storage/AmazonS3/bucket/bucket>
AMAZONS3(s3_internal)
AMAZONS3(s3_partner,"Vendor's S3")
s3_internal <- s3_partner
@enduml
You may also include the common.puml file, eg: !include <font-awesome/common>, which contains helper
macros defined. With the common.puml imported, you can use the NAME_OF_SPRITE(parameters...) macro.
Example of usage:
@startuml
!include <tupadr3/common>
!include <tupadr3/font-awesome/server>
!include <tupadr3/font-awesome/database>
FA_SERVER(web1,web1) #Green
FA_SERVER(web2,web2) #Yellow
FA_SERVER(web3,web3) #Blue
FA_SERVER(web4,web4) #YellowGreen
FA_DATABASE(db1,LIVE,database,white) #RoyalBlue
FA_DATABASE(db2,SPARE,database) #Red
@startuml
!include <tupadr3/common>
!include <tupadr3/devicons/mysql>
DEV_MYSQL(db1)
DEV_MYSQL(db2,label of db2)
DEV_MYSQL(db3,label of db3,database)
DEV_MYSQL(db4,label of db4,database,red) #DeepSkyBlue
@enduml
Notes
When mixing sprites macros with other elements you may get a syntax error if, for example, trying to add a rectangle
along with classes. In those cases, add { and } after the macro to create the empty rectangle.
Example of usage:
@startuml
!include <material/common>
' To import the sprite file you DON'T need to place a prefix!
!include <material/folder_move>
class foo {
bar
}
@enduml
22.8 Office
https://github.com/Roemer/plantuml-office
There are sprites (*.puml) and colored png icons available. Be aware that the sprites are all only monochrome even
if they have a color in their name (due to automatically generating the files). You can either color the sprites with
the macro (see examples below) or directly use the fully colored pngs. See the following examples on how to use
the sprites, the pngs and the macros.
Example of usage:
@startuml
!include <tupadr3/common>
!include <office/Servers/database_server>
!include <office/Servers/application_server>
!include <office/Concepts/firewall_orange>
!include <office/Clouds/cloud_disaster_red>
package "Sprites" {
OFF_DATABASE_SERVER(db,DB)
OFF_APPLICATION_SERVER(app,App-Server)
OFF_FIREWALL_ORANGE(fw,Firewall)
OFF_CLOUD_DISASTER_RED(cloud,Cloud)
db <-> app
app <--> fw
fw <.left.> cloud
}
@enduml
@startuml
!include <tupadr3/common>
!include <office/servers/database_server>
!include <office/servers/application_server>
!include <office/Concepts/firewall_orange>
!include <office/Clouds/cloud_disaster_red>
22.9 ArchiMate
https://github.com/ebbypeter/Archimate-PlantUML
This repository contains ArchiMate PlantUML macros and other includes for creating Archimate Diagrams easily
and consistantly.
@startuml
!include <archimate/Archimate>
' Elements
Business_Object(businessObject, "A Business Object")
Business_Process(someBusinessProcess,"Some Business Process")
Business_Service(itSupportService, "IT Support for Business (Application Service)")
'Relationships
Rel_Flow_Left(someBusinessProcess, businessObject, "")
Rel_Serving_Up(itSupportService, someBusinessProcess, "")
Rel_Specialization_Up(webpageBehaviour, itSupportService, "")
Rel_Flow_Right(dataObject, webpageBehaviour, "")
Rel_Specialization_Up(dataObject, businessObject, "")
Rel_Assignment_Left(ActivePartWebPage, webpageBehaviour, "")
Rel_Specialization_Up(inMemoryItem, dataObject, "")
Rel_Realization_Up(inMemoryItem, ActivePartWebPage, "")
Rel_Specialization_Right(inMemoryItem,internetBrowser, "")
Rel_Serving_Up(internetBrowser, webpageBehaviour, "")
Rel_Serving_Up(internetBrowserPlugin, webpageBehaviour, "")
Rel_Aggregation_Right(internetBrowser, internetBrowserPlugin, "")
Rel_Access_Up(webServer, inMemoryItem, "")
Rel_Serving_Up(webServer, internetBrowser, "")
@enduml
22.10 Kubernetes
https://github.com/michiel/plantuml-kubernetes-sprites
@startuml
!include <kubernetes/k8s-sprites-unlabeled-25pct>
package "Infrastructure" {
component "<$master>\nmaster" as master
component "<$etcd>\netcd" as etcd
component "<$node>\nnode" as node
}
@enduml
22.11 Miscellaneous
You can list standard library folders using the special diagram:
@startuml
stdlib
@enduml
It is also possible to use the command line java -jar plantuml.jar -stdlib to display the same list.
Finally, you can extract the full standard library sources using java -jar plantuml.jar -extractstdlib.
All files will be extracted in the folder stdlib.
Sources used to build official PlantUML releases are hosted here https://github.com/plantuml/plantuml-stdlib. You
can create Pull Request to update or add some library if you find it relevant.
Contents
1 Sequence Diagram 1
1.1 Basic examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Declaring participant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Use non-letters in participants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Message to Self . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Text alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5.1 Text of response message below the arrow . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 Change arrow style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.7 Change arrow color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.8 Message sequence numbering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.9 Page Title, Header and Footer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.10 Splitting diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.11 Grouping message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.12 Notes on messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.13 Some other notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.14 Changing notes shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.15 Creole and HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.16 Divider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.17 Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.18 Delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.19 Text wrapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.20 Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.21 Lifeline Activation and Destruction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.22 Return . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.23 Participant creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.24 Shortcut syntax for activation, deactivation, creation . . . . . . . . . . . . . . . . . . . . . . . . 18
1.25 Incoming and outgoing messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.26 Anchors and Duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.27 Stereotypes and Spots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.28 More information on titles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.29 Participants encompass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.30 Removing Foot Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.31 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.32 Changing padding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3 Class Diagram 39
3.1 Declaring element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.2 Relations between classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.12 Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
5.13 Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.14 Color on connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
5.15 Grouping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
5.16 Swimlanes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
5.17 Detach or kill [detach, kill] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
5.18 SDL (Specification and Description Language) . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
5.19 Complete example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
5.20 Condition Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
5.20.1 Inside style (by default) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
5.20.2 Diamond style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.20.3 InsideDiamond (or Foo1) style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.21 Condition End Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.21.1 Diamond style (by default) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
5.21.2 Horizontal line (hline) style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
6 Component Diagram 99
6.1 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.2 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.3 Basic example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.4 Using notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.5 Grouping Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
6.6 Changing arrows direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.7 Use UML2 notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
6.8 Use UML1 notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.9 Use rectangle notation (remove UML notation) . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
6.10 Long description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.11 Individual colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.12 Using Sprite in Stereotype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.13 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
11 MindMap 161
11.1 OrgMode syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
11.2 Multilines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
11.3 Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
11.3.1 With inline color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
11.3.2 With style color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
11.4 Removing box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
11.5 Arithmetic notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
11.6 Markdown syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
11.7 Changing style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
11.8 Changing diagram direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
11.9 Complete example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
11.10Word Wrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
14 Maths 183
14.1 Standalone diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
14.2 How is this working? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
17 Creole 228
17.1 Emphasized text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
17.2 List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
17.3 Escape character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
17.4 Horizontal lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
17.5 Headings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
17.6 Legacy HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
17.7 Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
17.8 Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
17.8.1 Build a table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
17.8.2 Add color on cells or lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
17.8.3 Add color on border . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
17.8.4 No border or same color as the background . . . . . . . . . . . . . . . . . . . . . . . . . 233
17.8.5 Bold header or not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
17.9 Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
20 Preprocessing 263
20.1 Migration notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
20.2 Variable definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
20.3 Boolean expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
20.3.1 Boolean represention [0 is false] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
20.3.2 Boolean operation and operator [&&, ||, ()] . . . . . . . . . . . . . . . . . . . . . . . . . 264
20.3.3 Boolean builtin functions [%false(), %true(), %not(<exp>)] . . . . . . . . . . . . . . . . 264
20.4 Conditions [!if, !else, !elseif, !endif] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
20.5 While loop [!while, !endwhile] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
20.6 Procedure [!procedure, !endprocedure] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
20.7 Return function [!function, !endfunction] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
20.8 Default argument value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
20.9 Unquoted procedure or function [!unquoted] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
21 Unicode 276
21.1 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
21.2 Charset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278