A transition is an arrow. A colon after the arrow is the event that causes it.
stateDiagram-v2
[*] --> Idle
Idle --> Running : start
Running --> Idle : stopThe same [*] marker does both: the arrow into it is the end, the arrow out of it is the start.
stateDiagram-v2
[*] --> Draft
Draft --> Published
Published --> [*]A diamond that asks a question. Each outgoing arrow is one answer.
stateDiagram-v2
[*] --> Check
Check --> Decide <<choice>>
Decide --> Accepted : if valid
Decide --> Rejected : if invalidCurly braces open a composite state. Its internal states live inside.
stateDiagram-v2
[*] --> Active
state Active {
[*] --> NumLockOff
NumLockOff --> NumLockOn : press
NumLockOn --> NumLockOff : press
}
Active --> [*]A fork splits the flow, a join waits for every branch to arrive.
stateDiagram-v2
[*] --> Split <<fork>>
Split --> A
Split --> B
A --> Merge <<join>>
B --> Merge
Merge --> [*]A note attaches to one state, or floats over two.
stateDiagram-v2
[*] --> Draft
Draft --> Review
note right of Draft
Still editable
end noteThe same keyword as flowcharts. Default is top to bottom.
stateDiagram-v2
direction LR
[*] --> Idle
Idle --> Running : start