Skip to content
BENIBIX Learn

Mermaid

Design🛠️ Design ToolsDiagram Tools

Also known as Mermaid.js, Mermaid Diagram, Mermaid Diagrams

Diagrams written as short lines of text. The tool draws the picture for you.

Think of it like

It is like telling a friend who sits next to whom. They draw the seat map for you.

Example

Emma adds a Mermaid flowchart to her project's README on GitHub. When the login steps change, she edits two lines of text, and the picture redraws.

Why it matters

The diagram lives beside the code and changes with it. Nobody needs a drawing tool to fix it.

Definition

Mermaid is a way to make diagrams by writing short lines of text. You type a line like A --> B, and Mermaid draws box A with an arrow to box B. It can draw flowcharts, sequence diagrams, Gantt charts, class diagrams and many more. GitHub, GitLab and many note apps draw Mermaid inside Markdown files. Because the diagram is text, a change shows up in a code review like any other line.

Example code

mermaid
flowchart LR
    A[Sign in] --> B{Password right?}
    B -- Yes --> C[Home page]
    B -- No --> A
Four lines of text. Mermaid turns them into a sign-in flowchart with a loop back.
On the right is the Mermaid way: two lines of text, and the boxes are drawn for you.

Common mistake

Fighting the layout. Mermaid places the boxes itself, so a diagram that needs exact places is easier in a drawing tool.

Key takeaways

  1. 1
    Text to picture. Write lines, get a diagram.
  2. 2
    Lives in Markdown. GitHub and GitLab draw it in Markdown.
  3. 3
    Auto layout. You pick the links, it picks the places.

Compare

Learn it properly