merIDK / Diagram types / Flowchart
Mermaid flowchart: example and syntax
Flowcharts are the most used Mermaid diagram. You describe each step as a node and connect the steps with arrows, and Mermaid lays them out for you. Use them for processes, decision trees, user flows and algorithms.
Open this example in the editor
Example code
---
title: Order fulfilment
---
flowchart LR
A([Order placed]) --> B{In stock?}
B -- Yes --> C[Pick & pack]
B -- No --> D[Backorder]
D --> E[(Supplier DB)]
E -.-> C
C ==> F[/Ship/]
F --> G((Delivered))
classDef done fill:#d1fae5,stroke:#059669,color:#064e3b
class G done
Result
---
title: Order fulfilment
---
flowchart LR
A([Order placed]) --> B{In stock?}
B -- Yes --> C[Pick & pack]
B -- No --> D[Backorder]
D --> E[(Supplier DB)]
E -.-> C
C ==> F[/Ship/]
F --> G((Delivered))
classDef done fill:#d1fae5,stroke:#059669,color:#064e3b
class G doneSyntax quick reference
- Start with
flowchart TD(top-down) orflowchart LR(left-right). - Shapes come from brackets:
[box],(rounded),{decision},[(database)],((circle)). - Arrows:
-->solid,-.->dotted,==>thick,-- text -->labelled. - Style nodes with
classDefandclass.
How to use it
- Open the example in the editor, or paste your own Mermaid code.
- Edit the code on the left. The preview updates as you type, and errors point to the line.
- Export SVG or PNG, copy a Markdown block for GitHub or Notion, or copy a share link.