Example
block-beta
columns 3
A["Frontend
(Astro)"] B["API
(Hono)"] C["Storage
(D1/R2)"]
space D["KV Cache"] space
E["CDN
(Cloudflare)"] F["Pages
Functions"] G["Workers
Cron"]
A --> B
B --> C
B --> D
E --> A
F --> B
G --> C Syntax
Grid and widths
block-beta
columns 3
Frontend API Database
space:3
CDN:2 Cache
Frontend --> API
API --> Database
API --> Cache columns N sets the grid. Name:2 makes a block two columns wide; space:3 skips three cells.
Labels, shapes, nesting
block-beta
columns 2
block:group:2
columns 2
a["App server"] b[("Postgres")]
end
c(["Load balancer"]) d{{"Queue"}}
c --> a Flowchart shape wrappers work on blocks. A block:id ... end pair nests a sub-grid with its own columns.
Styling
block-beta
columns 2
A B
style A fill:#e0e7ff,stroke:#4338ca
classDef db fill:#fef3c7
class B db Common mistakes
These are the parse errors that come up most, including in code written by ChatGPT and Claude. Paste any failing diagram into the editor and it marks the offending line.
-
More blocks in a row than
columnsallows and expecting them to stay on one line.Fix: Mermaid wraps to the next row. Raise
columnsor usespaceto pad. -
Arrow between blocks that were never declared.
Fix: Every ID in an arrow must appear as a block first.
-
Writing
blockwithout-beta.Fix: The keyword in Mermaid 11 is
block-beta.
Real-world examples
Complete, copy-ready blocks for common situations. Each one opens in the editor with a click.
Browse all examples →FAQ
When should I use a block diagram instead of a flowchart?
When placement matters more than flow: a layered architecture, a UI wireframe, a hardware board. For processes with branching, stay with a flowchart.
Can arrows have labels?
Yes: A -- "HTTPS" --> B.