PlantUML은 직관적이고 사용하기 쉬운 문법을 통해 시퀀스 다이어그램을 손쉽게 생성할 수 있도록 도와줍니다. 이를 통해 초보자부터 숙련된 디자이너까지 신속하게 개념을 정리하고 세련된 그래픽 출력을 얻을 수 있습니다.
PlantUML의 문법은 사용이 간편하도록 설계되어 있어 최소한의 노력으로 기본 개념을 익힐 수 있습니다. 이로 인해 학습 곡선이 줄어들고 다이어그램 제작 속도가 향상됩니다.
입력된 텍스트와 생성된 다이어그램 간의 직접적인 연관성이 유지됩니다. 이를 통해 시각적 출력이 초기 초안과 유사하게 표현되며, 예기치 않은 오류를 최소화하고 작업 흐름을 원활하게 만듭니다.
텍스트와 이미지 간의 긴밀한 관계는 디자인 프로세스를 단순화할 뿐만 아니라 속도를 높입니다. 불필요한 수정 작업을 줄여 사용자가 보다 효율적으로 다이어그램을 완성할 수 있도록 돕습니다.
텍스트를 작성하는 동안 최종 결과를 즉시 확인할 수 있어 생산성이 향상됩니다. 이 즉각적인 피드백 시스템을 통해 오류를 조기에 발견하고 수정할 수 있어 개념에서 완성 단계까지의 전환이 원활해집니다.
텍스트 기반 다이어그램은 수정이 간편합니다. 원본 텍스트에서 직접 조정할 수 있어 그래픽 편집 도구에서 발생할 수 있는 복잡성과 오류를 피할 수 있습니다.
결론적으로, PlantUML은 시퀀스 다이어그램을 생성하는 데 있어 강력하고 효율적인 접근 방식을 제공합니다. 간결성과 정확성을 강조하는 이 도구는 명확하고 정밀한 다이어그램을 손쉽게 제작하려는 모든 사용자에게 필수적인 자산이 될 것입니다.
더 나은 다이어그램 제작 경험을 위해
PlantUML의 주요 명령어를 참고하시기 바랍니다.
시퀀스
->
는 두 참여자들 사이의 메시지를 그리기 위해 사용된다.
참여자들은 명시적으로 선언하지 않아도 된다.
점선 화살표를 만들기 위해서는
-->
를 사용한다.
또한
<-
과
<--
를 사용할 수 있다.
출력되는 그림은 변경되지 않지만, 가독성을 향상시키는데 사용할 수 있다.
이는 시퀀스 다이어그램에만 적용되며, 다른 다이어그램에는 다른 규칙이 적용된다.
🎉 Copied!
|
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
|
WARNING
This translation need to be updated. WARNING
참여자를 선언하기 위해
participant
키워드를 사용하면, 해당 참여자에 더 많은 제어를 할 수 있습니다.
선언의 순서는 (기본으로)
표시되는 순서가됩니다.
또한, 참여자 선언에 다음과 같은 키워드를 사용하면, 참여자를 나타내는
모양을 바꿀 수 있습니다.
actor
boundary
control
entity
database
collections
queue
🎉 Copied!
|
@startuml
participant Participant as Foo
actor Actor as Foo1
boundary Boundary as Foo2
control Control as Foo3
entity Entity as Foo4
database Database as Foo5
collections Collections as Foo6
queue Queue as Foo7
Foo -> Foo1 : To actor
Foo -> Foo2 : To boundary
Foo -> Foo3 : To control
Foo -> Foo4 : To entity
Foo -> Foo5 : To database
Foo -> Foo6 : To collections
Foo -> Foo7: To queue
@enduml
|
as
키워드를 이용하여 참여자의 이름을 변경 할 수 있다.
또한, 참여자(actor, participant)의
배경 색을 변경 할 수도 있다.
🎉 Copied!
|
@startuml
actor Bob #red
' The only difference between actor
'and participant is the drawing
participant Alice
participant "I have a really\nlong name" as L #99FF99
/' You can also declare:
participant L as "I have a really\nlong name" #99FF99
'/
Alice->Bob: Authentication Request
Bob->Alice: Authentication Response
Bob->L: Log transaction
@enduml
|
order
키워드를 이용하여, 참여자의 출력 순서를 지정할 수 있다.
🎉 Copied!
|
@startuml
participant Last order 30
participant Middle order 20
participant First order 10
@enduml
|
참여자를 여러줄에서 선언할 수 있습니다.
🎉 Copied!
|
@startuml
participant Participant [
=Title
----
""SubTitle""
]
participant Bob
Participant -> Bob
@enduml
|
[Ref. QA-15232]
따옴표를 사용하여 참여자를 정의할 수 있다.
그리고 "
as
" 키워드를 사용하여 참여자를 별칭으로 사용 할 수도 있다.
🎉 Copied!
|
@startuml
Alice -> "Bob()" : Hello
"Bob()" -> "This is very\nlong" as Long
' You can also declare:
' "Bob()" -> Long as "This is very\nlong"
Long --> "Bob()" : ok
@enduml
|
참여자는 자기 자신에게 메시지를 보낼 수 있다.
\n 을 이용해서 여러 줄로 쓰는 것도 가능하다
🎉 Copied!
|
@startuml
Alice -> Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext
@enduml
|
🎉 Copied!
|
@startuml
Alice <- Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext
@enduml
|
[Ref. QA-1361]
화살표의 텍스트 정렬은
skinparam sequenceMessageAlign
을 사용하여
left
,
right
,
center
를 설정할 수 있습니다.
direction
또는
reverseDirection
을 사용하여 화살표 방향에 따라 텍스트 정렬을 할 수 있습니다.
skinparam 페이지에서 상세한 예제를 볼 수 있습니다.
🎉 Copied!
|
@startuml
skinparam sequenceMessageAlign right
Bob -> Alice : Request
Alice -> Bob : Response
@enduml
|
응답 메세지 텍스트를 화살표 아래에 배치하기
skinparam responseMessageBelowArrow true
명령을 이용하여 응답 메세지 텍스트를 화살표 하단에 배치할 수 있습니다.
🎉 Copied!
|
@startuml
skinparam responseMessageBelowArrow true
Bob -> Alice : hello
Bob <- Alice : ok
@enduml
|
다음 방법으로 화살표 스타일을 바꿀 수 있다 :
- 끝 부분에
x
를 추가하여 메시지가 전달되지 않았음을 표시 할 수 있다.
<
나 >
대신에 \
나 /
를 사용해서
- 아래쪽이나 위쪽 화살표만 표시한다.
- {$>$}를 두번 사용하여 화살표 모양을 얇게 표시 할 수 있다. (예.
>>
)
-
대신 --
를 사용해서 점선 화살표를 표시한다.
- 화살표 다음에 "o" 추가도 가능하다.
- 양쪽 끝에 화살표 추가도 가능하다.
🎉 Copied!
|
@startuml
Bob ->x Alice
Bob -> Alice
Bob ->> Alice
Bob -\ Alice
Bob \\- Alice
Bob //-- Alice
Bob ->o Alice
Bob o\\-- Alice
Bob <-> Alice
Bob <->o Alice
@enduml
|
다음의 표기법을 이용해서 각각 화살표의 색상을 바꿀 수 있다.
🎉 Copied!
|
@startuml
Bob -[#red]> Alice : hello
Alice -[#0000FF]->Bob : ok
@enduml
|
autonumber
키워드는 메시지에 자동으로 증가하는 번호를 매길 때에 사용합니다.
🎉 Copied!
|
@startuml
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
@enduml
|
autonumber <시작번호>
의 형태로 표시하면 특정 번호로 시작 할 수 있으며,
autonumber <시작번호> <증가값>
으로 표시 할 경우 증가 값을 조정하는 것도 가능하다.
🎉 Copied!
|
@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
|
쌍따옴표를 이용하여 표시 형식을 바꿀 수도 있다.
표시 형식은 자바 클래스
DecimalFormat
을 사용한다.
(
0
은 숫자를 의미하며,
#
은 숫자로 표시하되, 빈 자리이면 0 으로 채우라는 뜻이다).
몇 가지 html 태그를 사용 할 수 있다.
🎉 Copied!
|
@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
autonumber 40 10 "<font color=red><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
|
또한,
autonumber stop
키워드를 이용하여 번호 매김을 일시 정지할 수 있으며,
autonumber resume <증가값> <표시형식>
키워드를 이용하여 계속해서 번호를 매길 수 있다.
🎉 Copied!
|
@startuml
autonumber 10 10 "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
autonumber stop
Bob -> Alice : dummy
autonumber resume "<font color=red><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
autonumber stop
Bob -> Alice : dummy
autonumber resume 1 "<font color=blue><b>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
@enduml
|
.
,
;
,
,
,
:
같은 필드 구분자 또는 필드 구분자의 조합으로 2자리 또는 3자리의 번호의 시작 번호를 사용할 수 있습니다. 예제:
1.1.1
또는
1.1:1
.
자동으로 마지막 자릿수가 증가합니다.
첫째자리를 증가하려면,
autonumber inc A
를 사용하십시오. 둘째자리를 증가하려면,
autonumber inc B
를 사용하십시오.
🎉 Copied!
|
@startuml
autonumber 1.1.1
Alice -> Bob: Authentication request
Bob --> Alice: Response
autonumber inc A
'Now we have 2.1.1
Alice -> Bob: Another authentication request
Bob --> Alice: Response
autonumber inc B
'Now we have 2.2.1
Alice -> Bob: Another authentication request
Bob --> Alice: Response
autonumber inc A
'Now we have 3.1.1
Alice -> Bob: Another authentication request
autonumber inc B
'Now we have 3.2.1
Bob --> Alice: Response
@enduml
|
%autonumber%
변수를 사용하여
autonumber
를 사용할 수 있습니다.:
🎉 Copied!
|
@startuml
autonumber 10
Alice -> Bob
note right
the <U+0025>autonumber<U+0025> works everywhere.
Here, its value is ** %autonumber% **
end note
Bob --> Alice: //This is the response %autonumber%//
@enduml
|
[Ref. QA-7119]
title
키워드를 이용하여 페이지에 제목을 추가할 수 있다.
또한,
header
와
footer
를 이용하여, 각각 머리말과 꼬리말을 표시할 수도 있다.
🎉 Copied!
|
@startuml
header Page Header
footer Page %page% of %lastpage%
title Example Title
Alice -> Bob : message 1
Alice -> Bob : message 2
@enduml
|
newpage
키워드를 이용하여, 다이어그램을 여러 개의 이미지로 분리 할 수 있다.
newpage
키워드 뒤에 바로 새로 생성되는 페이지의 제목을 넣을 수 있다.
여러 페이지에 걸쳐 있는 긴 다이어그램을 출력할 때 유용하다.
(주: 예제에서 첫 번째 페이지만 표시되었지만, 실제로 잘 동작하는 기능이다.)
🎉 Copied!
|
@startuml
Alice -> Bob : message 1
Alice -> Bob : message 2
newpage
Alice -> Bob : message 3
Alice -> Bob : message 4
newpage A title for the\nlast page
Alice -> Bob : message 5
Alice -> Bob : message 6
@enduml
|
다음과 같은 키워드들을 사용하여 메세지를 그룹화 할 수 있다:
alt/else
opt
loop
par
break
critical
group
, 화면에 보여질 텍스트
헤더에 표시될 텍스트를 추가할 수 있다. (
group
에 대해서는, 다음
'보조 그룹 레이블'을 참조하십시오.).
end
키워드는 그룹을 닫는데 사용한다.
또한, 그룹을 중첩해서 만들 수도 있다.
🎉 Copied!
|
@startuml
Alice -> Bob: Authentication Request
alt successful case
Bob -> Alice: Authentication Accepted
else some kind of failure
Bob -> Alice: Authentication Failure
group My own label
Alice -> Log : Log attack start
loop 1000 times
Alice -> Bob: DNS Attack
end
Alice -> Log : Log attack end
end
else Another type of failure
Bob -> Alice: Please repeat
end
@enduml
|
group
을 위해,
[
하고
]
사이에, 머릿글에 표시되도록 보조 문자열이나 레이블을 추가할 수 있습니다.
🎉 Copied!
|
@startuml
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Failure
group My own label [My own label 2]
Alice -> Log : Log attack start
loop 1000 times
Alice -> Bob: DNS Attack
end
Alice -> Log : Log attack end
end
@enduml
|
[Ref. QA-2503]
메시지 다음에
note left
나
note right
키워드를 이용하여, 메시지에 노트를 추가할 수 있다.
또한, 한 번에 여러 줄의 노트를 추가하는 경우에는
end note
를 이용하여, 노트의 끝을 표시해 주어야 한다.
🎉 Copied!
|
@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 left of
,
note right of
,
note over
키워드를 이용하여 참여자의 상대적인 위치에 노트를 추가할 수도 있다.
노트의
배경 색을 변경함으로써, 노트를 강조하는 것도 가능하다.
한 번에 여러 줄의 노트를 추가하는 경우에는,
end note
를 이용하여 노트의 끝을 표시해 주어야 한다.
🎉 Copied!
|
@startuml
participant Alice
participant Bob
note left of Alice #aqua
This is displayed
left of Alice.
end note
note right of Alice: This is displayed right of Alice.
note over Alice: This is displayed over Alice.
note over Alice, Bob #FFAAAA: This is displayed\n over Bob and Alice.
note over Bob, Alice
This is yet another
example of
a long note.
end note
@enduml
|
hnote
와
rnote
키워드를 이용하여, 노트의 모양을 바꿀 수 있습니다:
hnote
는 육각형 노트;
rnote
는 사각형 노트.
🎉 Copied!
|
@startuml
caller -> server : conReq
hnote over caller : idle
caller <- server : conConf
rnote over server
"r" as rectangle
"h" as hexagon
endrnote
rnote over server
this is
on several
lines
endrnote
hnote over caller
this is
on several
lines
endhnote
@enduml
|
[Ref. QA-1765]
다음의 문법을 이용해서 모든 참여자에 걸치도록 노트를 작성할 수 있다:
note across: note_description
🎉 Copied!
|
@startuml
Alice->Bob:m1
Bob->Charlie:m2
note over Alice, Charlie: Old method for note over all part. with:\n ""note over //FirstPart, LastPart//"".
note across: New method with:\n""note across""
Bob->Alice
hnote across:Note across all part.
@enduml
|
[Ref. QA-9738]
/
을 사용하여 여러 개의 note를 같은 레벨로 정렬하여 작성할 수 있다 :
- without
/
(by default, the notes are not aligned)
🎉 Copied!
|
@startuml
note over Alice : initial state of Alice
note over Bob : initial state of Bob
Bob -> Alice : hello
@enduml
|
- with
/
(the notes are aligned)
🎉 Copied!
|
@startuml
note over Alice : initial state of Alice
/ note over Bob : initial state of Bob
Bob -> Alice : hello
@enduml
|
[Ref. QA-354]
creole 문법을 사용할 수도 있다:
🎉 Copied!
|
@startuml
participant Alice
participant "The **Famous** Bob" as Bob
Alice -> Bob : hello --there--
... Some ~~long delay~~ ...
Bob -> Alice : ok
note left
This is **bold**
This is //italics//
This is ""monospaced""
This is --stroked--
This is __underlined__
This is ~~waved~~
end note
Alice -> Bob : A //well formatted// message
note right of Alice
This is <back:cadetblue><size:18>displayed</size></back>
__left of__ Alice.
end note
note left of Bob
<u:red>This</u> is <color #118888>displayed</color>
**<color purple>left of</color> <s:red>Alice</strike> Bob**.
end note
note over Alice, Bob
<w:#FF33FF>This is hosted</w> by <img sourceforge.jpg>
end note
@enduml
|
==
구분자를 이용하여, 다이어그램을 논리적인 단계로 구분하여 나눌 수 있다.
🎉 Copied!
|
@startuml
== Initialization ==
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
== Repetition ==
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
|
ref over
키워드를 이용하여, 다이어그램에 참조를 표시할 수 있다.
🎉 Copied!
|
@startuml
participant Alice
actor Bob
ref over Alice, Bob : init
Alice -> Bob : hello
ref over Bob
This can be on
several lines
end ref
@enduml
|
...
을 이용하여, 다이어그램에 지연 상태를 나타낼 수 있으며, 그 위에 메시지를 추가할 수도 있다.
🎉 Copied!
|
@startuml
Alice -> Bob: Authentication Request
...
Bob --> Alice: Authentication Response
...5 minutes latter...
Bob --> Alice: Bye !
@enduml
|
긴 메시지를 줄 바꿈하려면, 문장 안에
\n
을 추가한다.
다른 방법은
maxMessageSize
설정을 사용한다:
🎉 Copied!
|
@startuml
skinparam maxMessageSize 50
participant a
participant b
a -> b :this\nis\nmanually\ndone
a -> b :this is a very long message on several words
@enduml
|
|||
을 이용하여 다이어그램에 공백을 나타낼 수 있으며, 공백에 얼마만큼의 픽셀을 사용할 것인지 숫자로 명시할 수도 있다.
🎉 Copied!
|
@startuml
Alice -> Bob: message 1
Bob --> Alice: ok
|||
Alice -> Bob: message 2
Bob --> Alice: ok
||45||
Alice -> Bob: message 3
Bob --> Alice: ok
@enduml
|
activate
와
deactivate
는 참여자의 활성화 여부를 표현하는데 사용한다.
참여자가 활성화되면, 참여자의 생명선이 나타난다.
activate
와
deactivate
는 바로 이전의 메시지에 적용된다.
destroy
는 참여자의 생명선이 끝났음을 표현한다.
🎉 Copied!
|
@startuml
participant User
User -> A: DoWork
activate A
A -> B: << createRequest >>
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: RequestCreated
deactivate B
A -> User: Done
deactivate A
@enduml
|
생명선은 중첩해서 사용할 수 있으며, 생명선에
색 을 넣을 수도 있다.
🎉 Copied!
|
@startuml
participant User
User -> A: DoWork
activate A #FFBBBB
A -> A: Internal call
activate A #DarkSalmon
A -> B: << createRequest >>
activate B
B --> A: RequestCreated
deactivate B
deactivate A
A -> User: Done
deactivate A
@enduml
|
return
키워드를 사용하여 자동활성화도 가능합니다.
🎉 Copied!
|
@startuml
autoactivate on
alice -> bob : hello
bob -> bob : self call
bill -> bob #005500 : hello from thread 2
bob -> george ** : create
return done in thread 2
return rc
bob -> george !! : delete
return success
@enduml
|
return
명령은 추가 텍스트 레이블과 함께 리턴 메시지를 생성합니다.
리턴되는 지점은 가장 최근에 생명선을 활성화 시킨 지점의 출발점이 된다.
문법은 간단히
return label
이며,
label
은 기존의 메시지와 마찬가지로 임의의 문자열을 쓸 수 있다.
🎉 Copied!
|
@startuml
Bob -> Alice : hello
activate Alice
Alice -> Alice : some action
return bye
@enduml
|
해당 메시지가 실제로 새 객체를
생성한다는 걸 강조하기 위해, 참여자가 첫 번째 메시지를 수신하기 전에
create
키워드를 사용할 수 있다.
🎉 Copied!
|
@startuml
Bob -> Alice : hello
create Other
Alice -> Other : new
create control String
Alice -> String
note right : You can also put notes!
Alice --> Bob : ok
@enduml
|
참여대상을 지정한 직후 다음 문법을 사용할 수 있습니다:
++
대상 활성화 (추가로 색을 따를 수 있습니다.)
--
원본 비활성화
**
대상 인스턴스 생성
!!
대상 인스턴스 파괴
🎉 Copied!
|
@startuml
alice -> bob ++ : hello
bob -> bob ++ : self call
bob -> bib ++ #005500 : hello
bob -> george ** : create
return done
return rc
bob -> george !! : delete
return success
@enduml
|
같은 줄에서 대상의 활성화와 비활성화를 혼용할 수 있습니다.
🎉 Copied!
|
@startuml
alice -> bob ++ : hello1
bob -> charlie --++ : hello2
charlie --> alice -- : ok
@enduml
|
🎉 Copied!
|
@startuml
@startuml
alice -> bob --++ #gold: hello
bob -> alice --++ #gold: you too
alice -> bob --: step1
alice -> bob : step2
@enduml
@enduml
|
[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 "
[
" or the
right "
]
" side of the diagram.
🎉 Copied!
|
@startuml
[-> A: DoWork
activate A
A -> A: Internal call
activate A
A ->] : << createRequest >>
A<--] : RequestCreated
deactivate A
[<- A: Done
deactivate A
@enduml
|
You can also have the following syntax:
🎉 Copied!
|
@startuml
[-> Bob
[o-> Bob
[o->o Bob
[x-> Bob
[<- Bob
[x<- Bob
Bob ->]
Bob ->o]
Bob o->o]
Bob ->x]
Bob <-]
Bob x<-]
@enduml
|
WARNING
This translation need to be updated. WARNING
You can have
short arrows with using
?
.
🎉 Copied!
|
@startuml
?-> Alice : ""?->""\n**short** to actor1
[-> Alice : ""[->""\n**from start** to actor1
[-> Bob : ""[->""\n**from start** to actor2
?-> Bob : ""?->""\n**short** to actor2
Alice ->] : ""->]""\nfrom actor1 **to end**
Alice ->? : ""->?""\n**short** from actor1
Alice -> Bob : ""->"" \nfrom actor1 to actor2
@enduml
|
[Ref. QA-310]
With
teoz
it is possible to add anchors to the diagram and use the anchors to specify duration time.
🎉 Copied!
|
@startuml
!pragma teoz true
{start} Alice -> Bob : start doing things during duration
Bob -> Max : something
Max -> Bob : something else
{end} Bob -> Alice : finish
{start} <-> {end} : some time
@enduml
|
You can use the
-P
command-line option to specify the pragma:
java -jar plantuml.jar -Pteoz=true
[Ref. issue-582]
It is possible to add stereotypes to participants using
<<
and
>>
.
In the stereotype, you can add a spotted character
in a colored circle using the syntax
(X,color)
.
🎉 Copied!
|
@startuml
participant "Famous Bob" as Bob << Generated >>
participant Alice << (C,#ADD1B2) Testable >>
Bob->Alice: First message
@enduml
|
By default, the
guillemet character is used to display the stereotype.
You can change this behavious using the skinparam
guillemet
:
🎉 Copied!
|
@startuml
skinparam guillemet false
participant "Famous Bob" as Bob << Generated >>
participant Alice << (C,#ADD1B2) Testable >>
Bob->Alice: First message
@enduml
|
🎉 Copied!
|
@startuml
participant Bob << (C,#ADD1B2) >>
participant Alice << (C,#ADD1B2) >>
Bob->Alice: First message
@enduml
|
It is possible to define stereotypes position (
top
or
bottom
) with the command
skinparam stereotypePosition
.
Top postion (by default)
🎉 Copied!
|
@startuml
skinparam stereotypePosition top
participant A<<st1>>
participant B<<st2>>
A --> B : stereo test
@enduml
|
Bottom postion
🎉 Copied!
|
@startuml
skinparam stereotypePosition bottom
participant A<<st1>>
participant B<<st2>>
A --> B : stereo test
@enduml
|
[Ref. QA-18650]
You can use
creole formatting in the title.
🎉 Copied!
|
@startuml
title __Simple__ **communication** example
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
|
You can add newline using \n
in the title description.
🎉 Copied!
|
@startuml
title __Simple__ communication example\non several lines
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
|
You can also define title on several lines using title
and end title
keywords.
🎉 Copied!
|
@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
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
@enduml
|
It is possible to draw a box around some participants, using
box
and
end box
commands.
You can add an optional title or a
optional background color, after the
box
keyword.
🎉 Copied!
|
@startuml
box "Internal Service" #LightBlue
participant Bob
participant Alice
end box
participant Other
Bob -> Alice : hello
Alice -> Other : hello
@enduml
|
It is also possible to nest boxes - to draw a box within a box - when using the teoz rendering engine, for example:
🎉 Copied!
|
@startuml
!pragma teoz true
box "Internal Service" #LightBlue
participant Bob
box "Subteam"
participant Alice
participant John
end box
end box
participant Other
Bob -> Alice : hello
Alice -> John : hello
John -> Other: Hello
@enduml
|
You can use the
hide footbox
keywords to remove the footer
of the diagram.
🎉 Copied!
|
@startuml
hide footbox
title Footer removed
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
@enduml
|
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:
🎉 Copied!
|
@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
User -> A: DoWork
activate A
A -> B: Create Request
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: Request Created
deactivate B
A --> User: Done
deactivate A
@enduml
|
🎉 Copied!
|
@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
User -> A: DoWork
activate A
A -> B: Create Request
activate B
B -> C: DoWork
activate C
C --> B: WorkDone
destroy C
B --> A: Request Created
deactivate B
A --> User: Done
deactivate A
@enduml
|
It is possible to tune some padding settings.
🎉 Copied!
|
@startuml
skinparam ParticipantPadding 20
skinparam BoxPadding 10
box "Foo1"
participant Alice1
participant Alice2
end box
box "Foo2"
participant Bob1
participant Bob2
end box
Alice1 -> Bob1 : hello
Alice1 -> Out : out
@enduml
|
Normal arrow
🎉 Copied!
|
@startuml
participant Alice as a
participant Bob as b
a -> b : ""-> ""
a ->> b : ""->> ""
a -\ b : ""-\ ""
a -\\ b : ""-\\\\""
a -/ b : ""-/ ""
a -// b : ""-// ""
a ->x b : ""->x ""
a x-> b : ""x-> ""
a o-> b : ""o-> ""
a ->o b : ""->o ""
a o->o b : ""o->o ""
a <-> b : ""<-> ""
a o<->o b : ""o<->o""
a x<->x b : ""x<->x""
a ->>o b : ""->>o ""
a -\o b : ""-\o ""
a -\\o b : ""-\\\\o""
a -/o b : ""-/o ""
a -//o b : ""-//o ""
a x->o b : ""x->o ""
@enduml
|
Itself arrow
🎉 Copied!
|
@startuml
participant Alice as a
participant Bob as b
a -> a : ""-> ""
a ->> a : ""->> ""
a -\ a : ""-\ ""
a -\\ a : ""-\\\\""
a -/ a : ""-/ ""
a -// a : ""-// ""
a ->x a : ""->x ""
a x-> a : ""x-> ""
a o-> a : ""o-> ""
a ->o a : ""->o ""
a o->o a : ""o->o ""
a <-> a : ""<-> ""
a o<->o a : ""o<->o""
a x<->x a : ""x<->x""
a ->>o a : ""->>o ""
a -\o a : ""-\o ""
a -\\o a : ""-\\\\o""
a -/o a : ""-/o ""
a -//o a : ""-//o ""
a x->o a : ""x->o ""
@enduml
|
Incoming and outgoing messages (with '[', ']')
Incoming messages (with '[')
🎉 Copied!
|
@startuml
participant Alice as a
participant Bob as b
[-> b : ""[-> ""
[->> b : ""[->> ""
[-\ b : ""[-\ ""
[-\\ b : ""[-\\\\""
[-/ b : ""[-/ ""
[-// b : ""[-// ""
[->x b : ""[->x ""
[x-> b : ""[x-> ""
[o-> b : ""[o-> ""
[->o b : ""[->o ""
[o->o b : ""[o->o ""
[<-> b : ""[<-> ""
[o<->o b : ""[o<->o""
[x<->x b : ""[x<->x""
[->>o b : ""[->>o ""
[-\o b : ""[-\o ""
[-\\o b : ""[-\\\\o""
[-/o b : ""[-/o ""
[-//o b : ""[-//o ""
[x->o b : ""[x->o ""
@enduml
|
Outgoing messages (with ']')
🎉 Copied!
|
@startuml
participant Alice as a
participant Bob as b
a ->] : ""->] ""
a ->>] : ""->>] ""
a -\] : ""-\] ""
a -\\] : ""-\\\\]""
a -/] : ""-/] ""
a -//] : ""-//] ""
a ->x] : ""->x] ""
a x->] : ""x->] ""
a o->] : ""o->] ""
a ->o] : ""->o] ""
a o->o] : ""o->o] ""
a <->] : ""<->] ""
a o<->o] : ""o<->o]""
a x<->x] : ""x<->x]""
a ->>o] : ""->>o] ""
a -\o] : ""-\o] ""
a -\\o] : ""-\\\\o]""
a -/o] : ""-/o] ""
a -//o] : ""-//o] ""
a x->o] : ""x->o] ""
@enduml
|
Short incoming and outgoing messages (with '?')
Short incoming (with '?')
🎉 Copied!
|
@startuml
participant Alice as a
participant Bob as b
a -> b : //Long long label//
?-> b : ""?-> ""
?->> b : ""?->> ""
?-\ b : ""?-\ ""
?-\\ b : ""?-\\\\""
?-/ b : ""?-/ ""
?-// b : ""?-// ""
?->x b : ""?->x ""
?x-> b : ""?x-> ""
?o-> b : ""?o-> ""
?->o b : ""?->o ""
?o->o b : ""?o->o ""
?<-> b : ""?<-> ""
?o<->o b : ""?o<->o""
?x<->x b : ""?x<->x""
?->>o b : ""?->>o ""
?-\o b : ""?-\o ""
?-\\o b : ""?-\\\\o ""
?-/o b : ""?-/o ""
?-//o b : ""?-//o ""
?x->o b : ""?x->o ""
@enduml
|
Short outgoing (with '?')
🎉 Copied!
|
@startuml
participant Alice as a
participant Bob as b
a -> b : //Long long label//
a ->? : ""->? ""
a ->>? : ""->>? ""
a -\? : ""-\? ""
a -\\? : ""-\\\\?""
a -/? : ""-/? ""
a -//? : ""-//? ""
a ->x? : ""->x? ""
a x->? : ""x->? ""
a o->? : ""o->? ""
a ->o? : ""->o? ""
a o->o? : ""o->o? ""
a <->? : ""<->? ""
a o<->o? : ""o<->o?""
a x<->x? : ""x<->x?""
a ->>o? : ""->>o? ""
a -\o? : ""-\o? ""
a -\\o? : ""-\\\\o?""
a -/o? : ""-/o? ""
a -//o? : ""-//o? ""
a x->o? : ""x->o? ""
@enduml
|
By default
🎉 Copied!
|
@startuml
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
|
LifelineStrategy
🎉 Copied!
|
@startuml
skinparam lifelineStrategy nosolid
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
|
[Ref. QA-9016]
In order to have solid life line in sequence diagrams, you can use:
skinparam lifelineStrategy solid
🎉 Copied!
|
@startuml
skinparam lifelineStrategy solid
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
|
[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
🎉 Copied!
|
@startuml
skinparam style strictuml
Bob -> Alice : hello
Alice -> Bob : ok
@enduml
|
[Ref. QA-1047]
By default, all participants are displayed.
🎉 Copied!
|
@startuml
participant Alice
participant Bob
participant Carol
Alice -> Bob : hello
@enduml
|
But you can
hide unlinked
participant.
🎉 Copied!
|
@startuml
hide unlinked
participant Alice
participant Bob
participant Carol
Alice -> Bob : hello
@enduml
|
[Ref. QA-4247]
It is possible to
color a group messages:
🎉 Copied!
|
@startuml
Alice -> Bob: Authentication Request
alt#Gold #LightBlue Successful case
Bob -> Alice: Authentication Accepted
else #Pink Failure
Bob -> Alice: Authentication Rejected
end
@enduml
|
[Ref. QA-4750 and QA-6410]
🎉 Copied!
|
@startuml
mainframe This is a **mainframe**
Alice->Bob : Hello
@enduml
|
[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+]
🎉 Copied!
|
@startuml
A ->(10) B: text 10
B ->(10) A: text 10
A ->(10) B: text 10
A (10)<- B: text 10
@enduml
|
🎉 Copied!
|
@startuml
A ->(40) B++: Rq
B -->(20) A--: Rs
@enduml
|
[Ref. QA-14145]
🎉 Copied!
|
@startuml
!pragma teoz true
A ->(50) C: Starts\nwhen 'B' sends
& B ->(25) C: \nBut B's message\n arrives before A's
@enduml
|
[Ref. QA-6684]
🎉 Copied!
|
@startuml
!pragma teoz true
S1 ->(30) S2: msg 1\n
& S2 ->(30) S1: msg 2
note left S1: msg\nS2 to S1
& note right S2: msg\nS1 to S2
@enduml
|
[Ref. QA-1072]
You can use the
&
teoz command to display parallel messages:
🎉 Copied!
|
@startuml
!pragma teoz true
Alice -> Bob : hello
& Bob -> Charlie : hi
@enduml
|
(See also Teoz architecture)