Skip to content

Mermaid diagrams

Draw a flowchart, sequence or other diagram from text.

Updated

Start a code block with mermaid, and write the diagram in Mermaid syntax. Anything after the word is the diagram’s title.

Publishing a page
Diagram source
flowchart LR
  A[Edit page] --> B[Push to GitHub]
  B --> C[Specly builds]
  C --> D[Site is live]
MDX
```mermaid Publishing a page
flowchart LR
A[Edit page] --> B[Push to GitHub]
B --> C[Specly builds]
C --> D[Site is live]
```

The diagram is drawn in the reader’s browser, using their theme’s colors, when it scrolls near the screen. Its source sits under it in a Diagram source disclosure, so screen readers and search read the text. If Mermaid can’t read the source, the source opens in place of the drawing.

Diagrams are drawn in .mdx pages. In a .md page, the source shows and the build warns.

A mermaid block becomes a Mermaid component with these props.

chartstring
The diagram’s source.
titlestring
A caption above the diagram.
Was this page helpful?

Report a problem

What’s the problem?

The docs team sees this. Other readers don’t.