State Diagram
Model state machines, lifecycle flows, and system behavior with Mermaid state diagrams.
stateDiagram-v2
[*] --> Draft
Draft --> InReview : submit
InReview --> Draft : request_changes
InReview --> Approved : approve
InReview --> Rejected : reject
Approved --> Published : publish
Published --> Archived : archive
Rejected --> Draft : revise
Archived --> [*]
state InReview {
[*] --> WaitingForReviewer
WaitingForReviewer --> UnderReview : reviewer_assigned
UnderReview --> [*]
}Model component states like loading, error, success, and empty in your frontend.
Visualize e-commerce order lifecycle from placed to delivered to refunded.
Map authentication states: unauthenticated, authenticating, authenticated, expired.
stateDiagram-v2Declare diagram type (use v2)[*] --> StateInitial transition from startState --> [*]Final transition to endA --> B : eventTransition with event labelstate Name { }Composite / nested statenote right of SAdd a note to a stateOpen FlowViz and type stateDiagram-v2.
Define the initial state with [*] --> StateName.
Add states by simply using them in transitions: StateA --> StateB : event.
Label transitions with the event that causes them after the colon.
Define terminal states with StateName --> [*].
Create composite states with state CompositeName { ... } for nested flows.
Export your diagram as SVG.
No signup. No install. Just open the editor and start writing.