Mermaid
Create diagrams and flowcharts using Mermaid syntax
The Mermaid component renders diagrams from text using the Mermaid.js library.
Usage
mdx
1<Mermaid2 chart={`3 graph TD4 A[Start] --> B{Decision}5 B -->|Yes| C[Action 1]6 B -->|No| D[Action 2]7 `}8 caption="Decision flowchart"9/>Live Examples
Flowchart
Sequence Diagram
Class Diagram
Props
| Prop | Type | Default | Description |
|---|---|---|---|
chart | string | required | Mermaid diagram definition |
caption | string | - | Caption below the diagram |
Diagram Types
Mermaid supports many diagram types:
- Flowcharts -
graph TDorgraph LR - Sequence diagrams -
sequenceDiagram - Class diagrams -
classDiagram - State diagrams -
stateDiagram-v2 - Entity Relationship -
erDiagram - Gantt charts -
gantt - Pie charts -
pie
Theme Support
Info
Mermaid diagrams automatically adapt to light and dark mode themes.