state (27)
state_all_types
Source (.mmd)
stateDiagram-v2
state fork1 <<fork>>
state join1 <<join>>
state decide <<choice>>
state hist1 <<history>>
[*] --> Idle
Idle --> fork1 : begin
fork1 --> TaskA
fork1 --> TaskB
TaskA --> join1
TaskB --> join1
join1 --> decide
decide --> Approved : valid
decide --> Rejected : invalid
Approved --> hist1
hist1 --> Done
Rejected --> Idle : retry
state Active {
[*] --> Running
Running --> Paused
Paused --> Running
--
[*] --> Logging
Logging --> Logging
}
Done --> Active
Active --> [*]
state_choice
Source (.mmd)
stateDiagram-v2
state check <<choice>>
[*] --> check
check --> A : yes
check --> B : no
A --> [*]
B --> [*]
state_choice_chain
Source (.mmd)
stateDiagram-v2
state isValid <<choice>>
state hasStock <<choice>>
state isPremium <<choice>>
[*] --> Received
Received --> isValid
isValid --> hasStock : valid
isValid --> Rejected : invalid
hasStock --> isPremium : in stock
hasStock --> Backordered : out of stock
isPremium --> Express : premium
isPremium --> Standard : regular
Express --> [*]
Standard --> [*]
Rejected --> [*]
Backordered --> [*]
state_classDef_all
Source (.mmd)
stateDiagram-v2
[*] --> Pending
Pending --> InProgress : assign
InProgress --> Review : submit
Review --> Done : approve
Review --> InProgress : reject
Done --> [*]
classDef waiting fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef active fill:#e8f5e9,stroke:#1b5e20,stroke-width:3px
classDef finished fill:#e3f2fd,stroke:#0d47a1,stroke-width:1px
class Pending waiting
class InProgress active
class Review waiting
class Done finished
state_composite
Source (.mmd)
stateDiagram-v2
[*] --> Active
state Active {
[*] --> Idle
Idle --> Running
Running --> Idle
}
Active --> [*]
state_concurrent
Source (.mmd)
stateDiagram-v2
[*] --> Active
state Active {
[*] --> NumLockOff
NumLockOff --> NumLockOn : EvNumLockPressed
NumLockOn --> NumLockOff : EvNumLockPressed
--
[*] --> CapsLockOff
CapsLockOff --> CapsLockOn : EvCapsLockPressed
CapsLockOn --> CapsLockOff : EvCapsLockPressed
}
Active --> [*]
state_concurrent_3_regions
Source (.mmd)
stateDiagram-v2
[*] --> Dashboard
state Dashboard {
[*] --> FetchingData
FetchingData --> DataReady : loaded
DataReady --> FetchingData : refresh
--
[*] --> Disconnected
Disconnected --> Connected : connect
Connected --> Disconnected : disconnect
--
[*] --> LogsIdle
LogsIdle --> Streaming : startLogs
Streaming --> LogsIdle : stopLogs
}
Dashboard --> [*]
state_disconnected
Source (.mmd)
stateDiagram-v2
[*] --> Alpha
Alpha --> Beta
Beta --> [*]
Gamma --> Delta
Delta --> Epsilon
Epsilon --> Gamma
state_empty_composite
Source (.mmd)
stateDiagram-v2
[*] --> Placeholder
state Placeholder {
}
Placeholder --> [*]
state_fork_join
Source (.mmd)
stateDiagram-v2
state fork1 <<fork>>
state join1 <<join>>
[*] --> fork1
fork1 --> A
fork1 --> B
A --> join1
B --> join1
join1 --> [*]
state_history
Source (.mmd)
stateDiagram-v2
[*] --> Active
state Active {
[*] --> Idle
Idle --> Running : start
Running --> Idle : stop
state hist1 <<history>>
Running --> hist1
}
Active --> Paused : pause
Paused --> Active : resume
state_history_in_composite
Source (.mmd)
stateDiagram-v2
[*] --> Editor
state Editor {
state hist1 <<history>>
[*] --> Editing
Editing --> Saving : save
Saving --> Editing : done
Editing --> Previewing : preview
Previewing --> Editing : back
Saving --> hist1 : interrupt
}
Editor --> Suspended : suspend
Suspended --> Editor : resume
state_large_20_states
Source (.mmd)
stateDiagram-v2
[*] --> OrderPlaced
OrderPlaced --> PaymentPending : checkout
PaymentPending --> PaymentProcessing : pay
PaymentProcessing --> PaymentFailed : declined
PaymentProcessing --> PaymentConfirmed : approved
PaymentFailed --> PaymentPending : retry
PaymentConfirmed --> FraudCheck
FraudCheck --> FraudFlagged : suspicious
FraudCheck --> InventoryCheck : cleared
FraudFlagged --> ManualReview
ManualReview --> Cancelled : reject
ManualReview --> InventoryCheck : approve
InventoryCheck --> BackorderQueue : unavailable
InventoryCheck --> Picking : available
BackorderQueue --> InventoryCheck : restocked
Picking --> Packing : picked
Packing --> LabelPrinting : packed
LabelPrinting --> ReadyToShip : labeled
ReadyToShip --> InTransit : dispatched
InTransit --> OutForDelivery : local hub
OutForDelivery --> Delivered : received
OutForDelivery --> DeliveryFailed : no access
DeliveryFailed --> InTransit : reschedule
Delivered --> [*]
Cancelled --> [*]
state_linear_chain
Source (.mmd)
stateDiagram-v2
[*] --> Step1
Step1 --> Step2 : next
Step2 --> Step3 : next
Step3 --> Step4 : next
Step4 --> Step5 : next
Step5 --> Step6 : next
Step6 --> Step7 : next
Step7 --> Step8 : next
Step8 --> Step9 : next
Step9 --> Step10 : next
Step10 --> [*]
state_multiple_forks
Source (.mmd)
stateDiagram-v2
state fork1 <<fork>>
state join1 <<join>>
state fork2 <<fork>>
state join2 <<join>>
[*] --> fork1
fork1 --> Download
fork1 --> Validate
fork1 --> Notify
Download --> join1
Validate --> join1
Notify --> join1
join1 --> Transform
Transform --> fork2
fork2 --> Compress
fork2 --> Encrypt
Compress --> join2
Encrypt --> join2
join2 --> [*]
state_nested_3_levels
Source (.mmd)
stateDiagram-v2
[*] --> Outer
state Outer {
[*] --> Middle
state Middle {
[*] --> Inner
state Inner {
[*] --> Core
Core --> Processing
Processing --> Core
Processing --> [*]
}
Inner --> [*]
}
Middle --> [*]
}
Outer --> [*]
state_nested_4_levels
Source (.mmd)
stateDiagram-v2
[*] --> System
state System {
[*] --> Subsystem
state Subsystem {
[*] --> Module
state Module {
[*] --> Component
state Component {
[*] --> Ready
Ready --> Busy
Busy --> Ready
Busy --> [*]
}
Component --> [*]
}
Module --> [*]
}
Subsystem --> [*]
}
System --> [*]
state_notes
Source (.mmd)
stateDiagram-v2
[*] --> Still
Still --> Moving : start
Moving --> Still : stop
Moving --> Crash
Crash --> [*]
note right of Still : Idle state
note left of Moving : Active state
state_notes_both_sides
Source (.mmd)
stateDiagram-v2
[*] --> Idle
Idle --> Active : start
Active --> Idle : stop
Active --> [*] : terminate
note left of Idle : Waiting for input
note right of Idle : Low power mode
note left of Active : Processing tasks
note right of Active : High CPU usage
state_notes_in_composite
Source (.mmd)
stateDiagram-v2
[*] --> Workflow
state Workflow {
[*] --> Draft
Draft --> Review : submit
Review --> Approved : accept
Review --> Draft : revise
Approved --> [*]
note right of Draft : Author edits content
note left of Review : Reviewer checks quality
note right of Approved : Ready for publish
}
Workflow --> [*]
note right of Workflow : Main editing pipeline
state_self_transition
Source (.mmd)
stateDiagram-v2
[*] --> Polling
Polling --> Polling : tick
Polling --> Polling : retry
Polling --> Received : data available
Received --> Processing
Processing --> Processing : partial result
Processing --> Done : complete
Done --> [*]
state_simple
Source (.mmd)
stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
state_single_state
Source (.mmd)
stateDiagram-v2
[*] --> Only
state_star_topology
Source (.mmd)
stateDiagram-v2
[*] --> Hub
Hub --> Auth : authenticate
Hub --> Search : query
Hub --> Upload : send file
Hub --> Download : fetch file
Hub --> Settings : configure
Hub --> Profile : view profile
Hub --> Notifications : check alerts
Hub --> Analytics : view stats
Hub --> Help : open help
Auth --> Hub : done
Search --> Hub : done
Upload --> Hub : done
Download --> Hub : done
Settings --> Hub : done
Profile --> Hub : done
Notifications --> Hub : done
Analytics --> Hub : done
Help --> Hub : done
Hub --> [*] : logout
state_style_composite
Source (.mmd)
stateDiagram-v2
[*] --> Pipeline
state Pipeline {
[*] --> Build
Build --> Test : compiled
Test --> Deploy : passed
Deploy --> [*]
}
Pipeline --> [*]
style Pipeline fill:#f5f5f5,stroke:#616161,stroke-width:2px
style Build fill:#c8e6c9,stroke:#2e7d32
style Test fill:#bbdefb,stroke:#1565c0
style Deploy fill:#ffe0b2,stroke:#e65100
state_styled
Source (.mmd)
stateDiagram-v2
[*] --> Idle
Idle --> Processing : start
Processing --> Success : done
Processing --> Error : fail
Error --> Idle : retry
Success --> [*]
classDef active fill:#4caf50,stroke:#2e7d32,stroke-width:2px
classDef error fill:#f44336,stroke:#b71c1c,stroke-width:2px
classDef waiting fill:#ff9800,stroke:#e65100
class Idle waiting
class Processing active
class Error error
style Success fill:#2196f3,stroke:#0d47a1
state_transition_labels
Source (.mmd)
stateDiagram-v2
[*] --> Idle : initialize
Idle --> Connecting : connect request
Connecting --> Connected : handshake complete
Connected --> Sending : send data
Sending --> Waiting : awaiting response
Waiting --> Processing : response received
Processing --> Connected : request handled
Connected --> Disconnecting : close connection
Disconnecting --> Idle : cleanup done
Idle --> [*] : shutdown