Diagrams / Mermaid Block Diagram: Syntax & Examples

Mermaid Block Diagram: Syntax & Examples

Learn Mermaid block diagram syntax with a grid-based example. Arrange components and spans, then distinguish grouping from process flow.

When to use Block Diagram

Build a Mermaid block diagram when grouping and relative placement are central to the explanation. Blocks work well for system layers, responsibilities, and a compact overview of related components. Define a small grid before adding text so the layout reinforces the information hierarchy.

Read the Block Diagram example

Diagram source

block-beta
columns 3
  Editor["Pele Editor"]:3
  Code["Code input"] Preview["Live preview"] Export["Export tools"]
  PNG["PNG"] SVG["SVG"] PDF["PDF"]
A full-width application block sits above its main responsibilities. Each lower block has a specific role. The grid shows composition; adjacency alone should not be interpreted as data flow.

How to use this tool

  1. Start with the example in the editor and identify the elements that answer your question.
  2. Replace the sample labels and values, previewing after each structural change.
  3. Review the diagram at its intended reading size, then keep the source and export the format your document accepts.

Syntax and interpretation

ConceptHow to apply it
Gridcolumns sets the grid width. A block can span several columns when it represents a larger grouping.
LabelsKeep the name of a component short and put detailed responsibilities in accompanying prose.
ConnectionsAdd explicit connections if flow matters. Use a flowchart when decisions and directed paths are the main story.

Common questions

When should I avoid a block diagram?

If the reader needs to follow an ordered process or a conversation over time, use a flowchart or sequence diagram. Spatial grouping alone does not explain sequence.