A reference gallery: every Mermaid diagram type the blog supports

May 27, 2026
meta mermaid reference

A live reference of every Mermaid diagram type this blog supports. Each block below is rendered through the same build-time pipeline as every other diagram on the site: rehype-mermaid + Playwright at SSR, mermaid’s embedded <style> stripped, the site’s class-scoped CSS owning the theme. They all swap palettes when you toggle dark/light.

If you’re curious how that theming actually works (and why it took five PRs to land), the long-form story is in Theming Mermaid diagrams properly. This page is the evergreen “what does it look like / how do I write one” companion.

Flowchart with two subgraphs

Standard subgraph layout. Cluster backgrounds get a subtle muted tint so they read as a grouped region without dominating; cluster titles sit in the page’s foreground color.

Origin (Astro SSR)

Edge Worker (Cloudflare)

yes

no

hit

miss

Request arrives

Authenticated?

KV cache lookup

Login redirect

Return cached

Fetch origin

Write KV

SSR render

D1

200 OK

Node-shape coverage in this one diagram alone: stadium (([Foo])), diamond ({Foo?}), rectangle ([Foo]), database cylinder ([(Foo)]). All themed.

Nested subgraphs

Subgraph-inside-subgraph. The two layers of the muted tint stack visibly — each adds a small step of contrast against the page background — so structure stays readable without explicit borders.

Production

Region: eu-west

Region: us-west

Worker C

Worker A

Worker B

Worker D

Load balancer

Sequence diagram with notes, loops, and alt blocks

A different element family: actor boxes, lifelines, message arrows, dashed return arrows, alt blocks, loop blocks, notes, and activation rectangles.

OriginKVWorkerClientOriginKVWorkerClientCache check firstalt[origin healthy][origin 5xx]loop[Retry up to 3 times]Subsequent requestshit KV in <5msGET /api/profileget(profile:user-42)null (miss)GET /profile/42200 + JSON502put(profile:user-42, json)200 + JSON

Mermaid normally bakes notes and activation bars in a hardcoded yellow that clashes against dark mode. The site CSS reroutes them to the theme’s accent and primary colors.

classDef for per-node tinting

When the default theme isn’t enough — say you want to mark one node as “critical” red and another as “async” blue — classDef lets you declare per-node colors that pass through the theme untouched.

Normal node

Normal node

Critical

Async

Normal end

Mermaid emits classDef styles as inline style="..." attributes on the rendered nodes. Inline styles beat the site’s class-scoped theme, so your custom colors win — exactly what you want.

Wide flowchart (overflow scroll)

Diagrams wider than the prose column horizontal-scroll inside their frame, with a sticky right-edge fade as a discoverability cue. Edge labels stay readable as they pass under the gradient.

skip

skip

Stage 1

Stage 2

Stage 3

Stage 4

Stage 5

Stage 6

Stage 7

Stage 8

Stage 9

Stage 10

Stage 11

Stage 12

Click the expand button at the top of any diagram to open a fullscreen modal where you can pan and zoom — useful for dense diagrams like this one.

State diagram

State diagrams use a different code path internally — transitions are emitted as <path class="transition">, not .flowchart-link — but from the author’s side it’s the same fenced block.

fetch()

200

4xx/5xx

dismiss

retry

give up

Idle

Loading

Success

Error

Start and end markers ([*]) render as small filled and ringed circles respectively.


If a diagram type you want to use isn’t represented here and you find something rendering oddly — washed-out fills in light mode, white blocks in dark, missing strokes — open an issue on the repo. The theme covers the common types but the SVG element zoo mermaid emits is large enough that there are probably edge cases I haven’t hit yet.