Class
Double dashes(--) means to draw diagram from top to bottom.
@startuml 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. endfooter @enduml
Output
Object
Note: You can't put the closing curly brackets on the same line. It needs to be on another line.
@startuml skinparam monochrome true skinparam shadowing false ' skinparam objectBackgroundColor white object "My user" as user { id = 123 name = "Dummy" } 'Dynamically add field. user : newField @enduml
Output
Component
@startuml [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 @enduml
Output
Commands
# 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
Theme
@startuml <style> group { BackgroundColor green LineStyle 5 LineThickness 3 } package { BackgroundColor palegreen LineStyle 2 LineThickness 2 } </style> package package1 { node n package p } @enduml
Reference
- https://plantuml-documentation.readthedocs.io/en/latest/index.html