PlantUML - Cheatsheet

By xngo on February 22, 2019


Double dashes(--) means to draw diagram from top to bottom.

skinparam titleFontColor #0000FF
title Class \n__Example__
/' Multiple lines comment starts here:
    avoid class name with space
class "My Class"{
class Company{
    -name: String
    #protectedVar: Int
    ~packagePrivateVar: Object[]
    +publicVar: Char
class Employee{
    -name: String
'Dynamically add fields and methods to existing class.
Employee : Total : int
Employee : void doSomeWork()
Employee : -void getPrivate()
Employee : #void getProtected()
Employee : ~void getPackagePrivate()
Employee : +void getPublic()
Employee --> Company
"My Class" --|> Company: Extension
left footer
<font color=red>Warning:</font>
This is a footer.


PlantUML - Class examples


Note: You can't put the closing curly brackets on the same line. It needs to be on another line.

skinparam monochrome true
skinparam shadowing false
' skinparam objectBackgroundColor white
object "My user" as user {
    id = 123
    name = "Dummy"
'Dynamically add field.
user : newField


PlantUML - Object examples


[Component description] as component_desc
() "Interface\n desc (up)" as interface_desc
() "Left side" as left
() "Right side" as right
() "Down" as down
component_desc -up-> interface_desc: go up
component_desc -down-> down: go down
component_desc -left-> left: go left
component_desc -right-> right: go right


PlantUML - Component examples


# Check whether GraphViz is installed.
java -jar plantuml.jar -testdot
# Generate diagram in PNG format.
java -jar plantuml.jar -tpng input.puml
# List all parameters, especially skinparam.
java -jar plantuml.jar -language


group {
    BackgroundColor green
    LineStyle 5
    LineThickness 3
package {
    BackgroundColor palegreen
    LineStyle 2
    LineThickness 2
package package1 {
node n
package p



About the author

Xuan Ngo is the founder of He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.