State Machine Examples
Use Mermaid state machine examples to document lifecycle states, approval workflows, and transitions in product or engineering systems.
Approval state machine example
Copy this example into the editor to preview it with Mermaid themes and layout presets.
stateDiagram-v2
[*] --> Draft
Draft --> InReview: submit
InReview --> Approved: approve
InReview --> Draft: request changes
Approved --> Published
Published --> [*]Preview, style, and export in one place
Mermaid Viewer keeps the workflow focused: paste Mermaid code, preview the rendered diagram, choose a theme or layout preset, then export PNG/SVG when the result is ready for documentation or slides.
Related Mermaid tools
Frequently Asked Questions
Can Mermaid create state machine diagrams?
Yes. Mermaid supports state diagrams with stateDiagram-v2 syntax for lifecycle and transition diagrams.
Can I preview state diagrams online?
Yes. Paste a Mermaid state diagram into Mermaid Viewer to preview and export it online.