| Creating sequence diagrams with PlantUML is remarkably straightforward. This ease of use is largely attributed to the user-friendly nature of its syntax, designed to be both intuitive and easy to remember. First and foremost, users appreciate the straightforward and intuitive syntax that PlantUML employs. This well-thought-out design means that even those new to diagram creation find it easy to grasp the basics quickly and without hassle. |
Another distinguishing feature is the close resemblance between the textual representation and the graphical output. This harmonious correlation ensures that the textual drafts translate quite accurately into graphical diagrams, providing a cohesive and predictable design experience without unpleasant surprises in the final output.
- Text-to-Graphic Correlation:
The strong correlation between the text and the graphical result not only simplifies the crafting process but also significantly speeds it up. Users benefit from a more streamlined process with fewer requirements for time-consuming revisions and adjustments.
- Efficient Crafting Process:
The ability to envisage the final graphical outcome while drafting the text is a feature that many find invaluable. It naturally fosters a smooth transition from initial draft to final presentation, enhancing productivity and reducing the likelihood of errors.
- Visualization While Drafting:
Importantly, editing existing diagrams is a hassle-free process. Since the diagrams are generated from text, users find that making adjustments is considerably easier and more precise than altering an image using graphical tools. It boils down to simply modifying the text, a process far more straightforward and less prone to errors than making changes through a graphical interface with a mouse. PlantUML facilitates a straightforward and user-friendly approach to creating and editing sequence diagrams, meeting the needs of both novices and seasoned designers alike. It skillfully leverages the simplicity of textual inputs to craft visually descriptive and accurate diagrams, thereby establishing itself as a must-have tool in the diagram creation toolkit. You can learn more about some of the common commands in PlantUML to enhance your diagram creation experience. In PlantUML sequence diagrams, the
- Easy Edits and Revisions:
-> sequence denotes a message sent between two participants, which are automatically recognized and do not need to be declared beforehand. Utilize dotted arrows by employing the
--> sequence, offering a distinct visualization in your diagrams. To improve readability without affecting the visual representation, use reverse arrows like
<--. However, be aware that this is specifically for sequence diagrams and the rules differ for other diagram types.
If the keyword
participant is used to declare a participant, more control on that participant is possible. The order of declaration will be the (default) order of display. Using these other keywords to declare participants will change the shape of the participant representation:
Rename a participant using the
as keyword. You can also change the background color of actor or participant. You can use the
order keyword to customize the display order of participants.
You can declare participant on multi-line. [Ref. QA-15232] You can use quotes to define participants. And you can use the
as keyword to give an alias to those participants. A participant can send a message to itself. It is also possible to have multi-line using
[Ref. QA-1361] Text alignment on arrows can be set to
skinparam sequenceMessageAlign. You can also use
reverseDirection to align text depending on arrow direction. Further details and examples of this are available on the skinparam page.
Text of response message below the arrow You can put the text of the response message below the arrow, with the
skinparam responseMessageBelowArrow true command.
You can change arrow style by several ways:
You can change the color of individual arrows using the following notation: The keyword
- add a final
x to denote a lost message
/ instead of
> to have only the bottom or top part of the arrow
- repeat the arrow head (for example,
//) head to have a thin drawing
-- instead of
- to have a dotted arrow
- add a final "o" at arrow head
- use bidirectional arrow
autonumber is used to automatically add an incrementing number to messages. You can specify a startnumber with
autonumber <start> , and also an increment with
autonumber <start> <increment>. You can specify a format for your number by using between double-quote. The formatting is done with the Java class
0 means digit,
# means digit and zero if absent). You can use some html tag in the format. You can also use
autonumber stop and
autonumber resume <increment> <format> to respectively pause and resume automatic numbering. Your startnumber can also be a 2 or 3 digit sequence using a field delimiter such as
: or a mix of these. For example:
1.1:1. Automatically the last digit will increment. To increment the first digit, use:
autonumber inc A. To increment the second digit, use:
autonumber inc B. You can also use the value of
autonumber with the
[Ref. QA-7119] The
title keyword is used to add a title to the page. Pages can display headers and footers using
newpage keyword is used to split a diagram into several images. You can put a title for the new page just after the
newpage keyword. This title overrides the previously specified title if any. This is very handy with Word to print long diagram on several pages. (Note: this really does work. Only the first page is shown below, but it is a display artifact.) It is possible to group messages together using the following keywords:
It is possible to add a text that will be displayed into the header (for
group, followed by a text to be displayed
group, see next paragraph 'Secondary group label'). The
end keyword is used to close the group. Note that it is possible to nest groups.
group, it is possible to add, between
], a secondary text or label that will be displayed into the header. [Ref. QA-2503] It is possible to put notes on message using the
note left or
note right keywords just after the message. You can have a multi-line note using the
end note keywords. It is also possible to place notes relative to participant with
note left of ,
note right of or
note over keywords. It is possible to highlight a note by changing its background color. You can also have a multi-line note using the
end note keywords.
You can use
rnote keywords to change note shapes :
[Ref. QA-1765] You can directly make a note over all participants, with the syntax:
hnote for hexagonal note;
rnote for rectangle note.
[Ref. QA-9738] You can make several notes aligned at the same level, with the syntax
note across: note_description
/(by default, the notes are not aligned)
[Ref. QA-354]It is also possible to use creole formatting: If you want, you can split a diagram using
/(the notes are aligned)
== separator to divide your diagram into logical steps.
You can use reference in a diagram, using the keyword
ref over. You can use
... to indicate a delay in the diagram. And it is also possible to put a message with this delay.
To break long messages, you can manually add
\n in your text. Another option is to use
You can use
||| to indicate some spacing in the diagram. It is also possible to specify a number of pixel to be used. The
deactivate are used to denote participant activation. Once a participant is activated, its lifeline appears. The
deactivate apply on the previous message. The
destroy denote the end of the lifeline of a participant. Nested lifeline can be used, and it is possible to add a color on the lifeline. Autoactivation is possible and works with the return keywords:
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. You can use the
create keyword just before the first reception of a message to emphasize the fact that this message is actually creating this new object. Immediately after specifying the target participant, the following syntax can be used:
Then you can mix activation and deactivation, on same line: [Ref. QA-4834, QA-9573 and QA-13234] You can use incoming or outgoing arrows if you want to focus on a part of the diagram. Use square brackets to denote the left "
++ Activate the target (optionally a color may follow this)
-- Deactivate the source
** Create an instance of the target
!! Destroy an instance of the target
[" or the right "
]" side of the diagram. You can also have the following syntax:
You can have short arrows with using
?. [Ref. QA-310] With
teoz it is possible to add anchors to the diagram and use the anchors to specify duration time. You can use the
-Pcommand-line option to specify the pragma:
java -jar plantuml.jar -Pteoz=true
[Ref. issue-582] It is possible to add stereotypes to participants using
>>. In the stereotype, you can add a spotted character in a colored circle using the syntax
(X,color). By default, the guillemet character is used to display the stereotype. You can change this behavious using the skinparam
guillemet: You can use creole formatting in the title.
You can add newline using
\n in the title description.
You can also define title on several lines using It is possible to draw a box around some participants, using
end title keywords.
end box commands. You can add an optional title or a optional background color, after the
box keyword. It is also possible to nest boxes - to draw a box within a box - when using the teoz rendering engine, for example:
You can use the
hide footbox keywords to remove the foot boxes of the diagram. You can use the skinparam command to change colors and fonts for the drawing. You can use this command: You can also change other rendering parameter, as seen in the following examples: It is possible to tune some padding settings.
Incoming and outgoing messages (with '[', ']')
Incoming messages (with '[')
Outgoing messages (with ']')
Short incoming and outgoing messages (with '?')
Short incoming (with '?')
Short outgoing (with '?')
[Ref. QA-9016] In order to have solid life line in sequence diagrams, you can use:
skinparam lifelineStrategy solid[Ref. QA-2794]
style strictuml To be conform to strict UML (for arrow style: emits triangle rather than sharp arrowheads), you can use:
skinparam style strictuml
[Ref. QA-1047] By default, all participants are displayed. But you can
hide unlinked participant. [Ref. QA-4247] It is possible to color a group messages:
[Ref. QA-4750 and QA-6410][Ref. QA-4019 and Issue#148] You can use the
(nn) option (before or after arrow) to make the arrows slanted, where nn is the number of shift pixels. [Available only after v1.2022.6beta+]