Organization
PlantUML provides many organizational options for sequence diagrams. There are tools for visually grouping and separating information. It even has a nice page break option if you need to print, make a PDF, or present.
Title
Titles are created with the title command and the text for the diagram title. The title supports creole syntax for emphasis and markup language for color and emphasis. You can define colors with a standard color name or hex code.
Titles can be single-line or multiline. Use for manual line breaks. For automatic line breaks, use the end title command. You will need to define color and emphasis for every line break.
Titles can also contain images. Use the <img> markup tag to insert images in the title text. You can adjust the size of the image with the {scale} property.
Example: Title With Manual Line Breaks and Creole
Example: Title With Automatic Line Breaks and Markup
Example: Title Image
Header & Footer with Page Numbers
You can add a header and footer with the words header and footer. Follow each with the desired text. You can use creole for emphasis in the header.
Example: Header & Footer with Page Numbers
Page Break
You can add a page break with the newpage command. This command has an optional text field. The text field will change the title of the new page. This text field is less robust than an actual title. You must use manual line breaks to create a multiline title here. It does support creole syntax for emphasis and markup language for color and emphasis. You can define colors with a standard color name or hex code. You will need to define color and emphasis for every line break.
Example: Page Break
Dividers
You can add dividers to a sequence diagram with four equal signs. The divider has an optional text field. To utilize text place it in the middle of the equal signs. To create a multiline divider use manual line breaks. The divider supports creole syntax for emphasis and markup language for color and emphasis. You can define colors with a standard color name or hex code. The default font for dividers is bold, so adding code for bold emphasis will do nothing.
Example: Dividers
Vertical Spacing
You can add vertical space between messages with the pipe character. Three consecutive pipe characters will add a default amount of 25 pixels between messages. To customize the added amount, use four pipes with a whole number in the middle.
Example: Vertical Spacing
Delays
You can show a delay on your diagram with three consecutive periods. You can add text to the delay by using six periods with your chosen text in the middle. To create a multiline delay use manual line breaks. Delays support creole syntax for emphasis and markup language for color and emphasis. You can define colors with a standard color name or hex code.
Notice that when you use delays, the lifeline changes from the default dashed line into a solid line.
Example: Delays
DurationConstraint
DurationConstraints consist of four parts. First, you must change the !pragma teoz setting to true. Second, place an anchor at the start point. Anchors are created with a {string} inside of curly braces. Anchors are placed at the beginning of a message line. Third, place an anchor at the end point of the durationConstraint. Finally, you will define which anchors are the beginning and end of each durationConstraint and place the text.
To create a multiline durationConstraint, use manual line breaks. The durationConstraint supports creole syntax for emphasis and markup language for color and emphasis. You can define colors with a standard color name or hex code. The default font for durationConstraint is bold, so adding code for bold emphasis will do nothing.
Example: DurationConstraint
Boxes
Boxes are useful for visual organization. They draw a box around participant lifelines that you want to group together.
Defining Boxes
Boxes are defined with the box and end box commands. Place the respective commands above and below the declared lifelines you want the box to encompass.
Example: Defining Boxes
Box Title
Boxes have an optional title field that will appear at the top of the box. If used, this field comes immediately after the box command. To create a multiline title use manual line breaks. The title supports creole syntax for emphasis and markup language for color and emphasis. You can define colors with a standard color name or hex code. The default font for title is bold so adding code for bold emphasis will do nothing.
Example: Box Title
Box Color
Boxes have an optional color property. You can change the color by adding a standard color name or hex code after a hash mark. The color property is always the last property on the box line. You can use two colors separated by a forward slash to make a gradient.
Example: Box Color
Mainframe
Mainframe draws a box around the entire diagram. It has a mandatory title field. To create a multiline title use manual line breaks. The title supports creole syntax for emphasis and markup language for color and emphasis. You can define colors with a standard color name or hex code.
Example: Mainframe
Last updated
Was this helpful?