A Mermaid diagram is a diagram written in Mermaid, an open source, JavaScript based tool that renders diagrams from a simple text syntax. A few lines of text describe the nodes and their connections, and Mermaid draws the flowchart, sequence diagram or chart. It is one of the most widely used forms of diagram as code.
How Mermaid syntax works
Each diagram starts with a keyword for its type, followed by lines that define elements and links.
flowchart TD
A[Order received] --> B{In stock?}
B -- Yes --> C[Ship order]
B -- No --> D[Notify customer]
flowchart TD asks for a flowchart drawn from top to bottom. Square brackets make a box, curly brackets make a decision, and arrows connect them, with optional labels on the arrows.
Types of Mermaid diagrams
Mermaid supports many diagram types, including:
Class and state diagrams, two kinds of UML diagram
Entity relationship diagrams, see ER diagram
Mind maps, pie charts and timelines
Where Mermaid is used
Mermaid renders in many places where people already write Markdown, such as GitHub, documentation sites and note taking apps. That makes it popular for README files, technical documentation and design notes. AI assistants also often answer with Mermaid when asked for a diagram, because it is compact and easy to generate as text.
Advantages and limitations
Mermaid diagrams are quick to write, easy to keep in version control and consistent in style. The main limits are layout and editing. Positions are chosen automatically, so a large diagram can become hard to read, and changing one requires editing the text, which is unfamiliar to people outside engineering. A Mermaid block in a chat or a file is also static: nobody can drag a box, add a comment or continue the discussion on it.
Tips for readable Mermaid diagrams
Keep each diagram small. Split a large system into several diagrams.
Use clear node labels. Short identifiers with full text labels are easiest to maintain.
Choose the direction. Top to bottom suits processes, left to right suits pipelines.
Label decisions. Put the condition on each outgoing arrow.
Example
Sam documents a deployment pipeline in a README with six lines of Mermaid: build, test, a decision for whether tests pass, deploy to staging and deploy to production. When a security scan is added, he inserts one line and the diagram redraws.
Mermaid diagrams in MockFlow
The Mermaid diagram editor artifact brings Mermaid onto a MockFlow board, next to the rest of the team's work. If you would prefer not to write syntax, the AI diagram generator builds editable diagrams from a description, and AI apps can create boards through the MockFlow MCP server. See also text to diagram and whiteboard for developers.
