Mermaid Diagram Tutorials & Examples

Master the art of diagram creation with our comprehensive tutorials, practical examples, and expert tips. From basic flowcharts to advanced AI-powered diagrams, learn everything you need to know.

Step-by-Step Guides Real Examples AI-Powered Tips
UML 8 min read

Class Diagrams: Object-Oriented Design with Mermaid

Comprehensive tutorial on creating class diagrams to represent object-oriented software designs, including classes, interfaces, inheritance, and relationships.

October 4, 2025
Data Visualization 4 min read

Pie Charts and Data Visualization with Mermaid

Create compelling pie charts and other data visualizations using Mermaid's powerful charting capabilities for reports, dashboards, and presentations.

October 6, 2025
Collaboration 5 min read

Real-Time Collaboration: Building Diagrams Together

Discover the power of real-time diagram editing and how it transforms team collaboration, feedback loops, and productivity in diagram creation workflows.

October 8, 2025
Advanced 10 min read

Advanced Mermaid Diagrams: ER, Mind Maps, and Beyond

Explore advanced diagram types including entity-relationship diagrams, mind maps, journey diagrams, git graphs, C4 architecture, and other specialized visualizations.

October 9, 2025

Ready to Create Your Own Diagrams?

Start creating beautiful Mermaid diagrams with our free online editor. No registration required!

Tutorial

Mastering Flowcharts: A Complete Guide to Mermaid Flow Diagrams

October 1, 2025 5 min read

Learn how to create professional flowcharts with Mermaid.js syntax, from basic decision trees to complex process flows with conditional logic and multiple paths.

What is a Flowchart?

Flowcharts are visual representations of processes, workflows, or systems. They use standardized symbols to show the sequence of steps, decisions, and outcomes in a process. Mermaid.js makes creating beautiful, interactive flowcharts simple with its text-based syntax.

Basic Flowchart Syntax

Here's the basic structure for creating a flowchart in Mermaid:

graph TD
    A[Start] --> B{Decision Point}
    B -->|Yes| C[Process 1]
    B -->|No| D[Process 2]
    C --> E[End]
    D --> E

Flowchart Symbols and Their Meanings

  • Rectangle (Process): Represents a process or action step
  • Diamond (Decision): Represents a decision point with yes/no outcomes
  • Rounded Rectangle (Terminal): Represents start or end points
  • Arrow (Flow Line): Shows the direction of flow between elements

Advanced Flowchart Features

Mermaid supports advanced features like subgraphs, styling, and complex conditional flows:

graph TD
    subgraph "User Authentication"
        A[Start] --> B[Enter Credentials]
        B --> C{Valid Credentials?}
        C -->|Yes| D[Grant Access]
        C -->|No| E[Show Error]
        E --> B
    end
    D --> F[Welcome Page]

Best Practices for Flowcharts

  1. Keep it Simple: Don't overcrowd your flowchart with too many elements
  2. Use Consistent Symbols: Stick to standard flowchart symbols
  3. Logical Flow: Ensure the flow moves from left to right or top to bottom
  4. Clear Labels: Use descriptive, concise labels for each element
  5. Test the Logic: Walk through your flowchart to ensure it makes sense

Try it yourself!

Head over to the Mermaid Canvas editor and paste this flowchart code to see it in action:

graph TD
    A[User Login] --> B{Valid User?}
    B -->|Yes| C[Dashboard]
    B -->|No| D[Error Message]
    D --> A
Guide

Sequence Diagrams Made Simple: Visualizing System Interactions

October 2, 2025 7 min read

Step-by-step guide to creating sequence diagrams that clearly show how different parts of your system interact over time, including actors, lifelines, and messages.

Understanding Sequence Diagrams

Sequence diagrams are a type of interaction diagram that shows how objects interact with each other over time. They are particularly useful for understanding the flow of messages between different components of a system.

Basic Sequence Diagram Structure

The basic syntax for sequence diagrams in Mermaid is straightforward:

sequenceDiagram
    participant User
    participant System
    participant Database

    User->>System: Login Request
    System->>Database: Validate Credentials
    Database-->>System: User Data
    System-->>User: Login Success

Key Elements of Sequence Diagrams

  • Participants: Represent the objects or actors in the interaction
  • Lifelines: Vertical dashed lines showing the lifetime of participants
  • Messages: Arrows showing communication between participants
  • Activation Bars: Rectangles showing when a participant is active

Message Types

Mermaid supports different types of messages:

  • Solid arrow (->>): Synchronous message (calling a method)
  • Open arrow (-->>): Return message (response)
  • Dashed arrow (-->): Asynchronous message
  • Cross (x): Destruction message (object termination)

Advanced Features

Sequence diagrams can include notes, loops, and complex interactions:

sequenceDiagram
    participant User
    participant API
    participant Cache
    participant Database

    User->>API: GET /users
    API->>Cache: Check Cache
    Cache-->>API: Cache Miss

    API->>Database: SELECT * FROM users
    Database-->>API: User Data

    API->>Cache: Store in Cache
    API-->>User: User List

    Note over User,Database: This shows a typical
API call with caching

Best Practices

  1. Keep it Focused: Don't try to show too many participants
  2. Use Clear Names: Make participant names descriptive
  3. Show Important Interactions: Focus on key system interactions
  4. Add Notes: Use notes to explain complex interactions

Interactive Example

Copy this sequence diagram to Mermaid Canvas to explore how system components interact:

sequenceDiagram
    participant Alice
    participant Bob
    Alice->>Bob: Hello Bob, how are you?
    Bob-->>Alice: I am good thanks!
Project Management

Gantt Charts in Mermaid: Project Management Visualization

October 3, 2025 6 min read

Discover how to use Mermaid Gantt charts to plan, track, and communicate project timelines effectively with dependencies, milestones, and resource allocation.

What are Gantt Charts?

Gantt charts are project management tools that provide a visual timeline of project tasks, showing when each task should start and finish. They help teams understand project schedules, dependencies, and progress at a glance.

Creating Gantt Charts in Mermaid

Mermaid makes creating Gantt charts simple with its text-based syntax:

gantt
    title Project Timeline
    dateFormat YYYY-MM-DD
    section Planning
    Define requirements    :done, req1, 2025-01-01, 2025-01-05
    Create wireframes      :done, wire1, 2025-01-06, 2025-01-10
    section Development
    Frontend development   :active, front1, 2025-01-11, 2025-01-25
    Backend development    :back1, after front1, 2025-01-20, 2025-01-30
    section Testing
    QA testing            :test1, after back1, 2025-02-01, 2025-02-05

Key Gantt Chart Elements

Task Status and Styling

You can indicate task status and add visual styling:

Advanced Gantt Features

Gantt charts support complex project structures:

gantt
    title Software Development Lifecycle
    dateFormat YYYY-MM-DD

    section Research
    Market research     :done, research1, 2025-01-01, 2025-01-07
    User interviews     :done, research2, 2025-01-08, 2025-01-14

    section Design
    UI/UX Design        :done, design1, 2025-01-15, 2025-01-28
    Technical Design    :active, design2, 2025-01-29, 2025-02-11

    section Development
    Frontend Dev        :front1, after design2, 2025-02-12, 2025-03-01
    Backend Dev         :back1, after design2, 2025-02-15, 2025-03-05
    API Integration     :api1, after front1, 2025-03-02, 2025-03-08

    section Testing
    Unit Testing        :test1, after back1, 2025-03-06, 2025-03-12
    Integration Testing :test2, after api1, 2025-03-09, 2025-03-15
    User Acceptance     :uat1, after test2, 2025-03-16, 2025-03-20

    section Deployment
    Production Deploy   :milestone, deploy1, 2025-03-21, 2025-03-21

Best Practices for Gantt Charts

  1. Keep it Realistic: Don't over-optimistically schedule tasks
  2. Include Dependencies: Show task relationships clearly
  3. Use Sections: Group related tasks logically
  4. Regular Updates: Keep the chart current as work progresses
  5. Include Milestones: Mark important project checkpoints

Project Planning Template

Use this template in Mermaid Canvas to plan your next project:

gantt
    title My Project Timeline
    dateFormat YYYY-MM-DD
    section Planning
    Requirements    :done, req, 2025-01-01, 2025-01-05
    section Execution
    Development     :active, dev, 2025-01-06, 2025-01-20
    Testing         :test, after dev, 2025-01-21, 2025-01-25
UML

Class Diagrams: Object-Oriented Design with Mermaid

October 4, 2025 8 min read

Comprehensive tutorial on creating class diagrams to represent object-oriented software designs, including classes, interfaces, inheritance, and relationships.

What are Class Diagrams?

Class diagrams are a type of UML (Unified Modeling Language) diagram that shows the structure of a system by displaying classes, their attributes, operations, and relationships between classes. They are fundamental to object-oriented design.

Basic Class Syntax

In Mermaid, you define classes with their properties and methods:

classDiagram
    class Animal {
        +String name
        +int age
        +makeSound()
        +eat()
    }

    class Dog {
        +String breed
        +bark()
        +fetch()
    }

    class Cat {
        +String color
        +meow()
        +purr()
    }

    Animal <|-- Dog
    Animal <|-- Cat

Class Components

  • Class Name: The name of the class
  • Attributes: Properties/fields of the class
  • Methods: Operations/functions of the class
  • Visibility: Public (+), Private (-), Protected (#)

Relationship Types

Class diagrams show different types of relationships:

  • Inheritance ( <|-- ): One class extends another
  • Composition ( *-- ): One class contains another (strong relationship)
  • Aggregation ( o-- ): One class contains another (weaker relationship)
  • Association ( --> ): Classes are related but independent
  • Dependency ( ..> ): One class depends on another

Advanced Class Features

Mermaid supports interfaces, abstract classes, and complex relationships:

classDiagram
    class Shape {
        <<interface>>
        +calculateArea()
        +calculatePerimeter()
    }

    class Circle {
        -double radius
        +calculateArea()
        +calculatePerimeter()
    }

    class Rectangle {
        -double width
        -double height
        +calculateArea()
        +calculatePerimeter()
    }

    class DrawingApp {
        +List~Shape~ shapes
        +addShape()
        +removeShape()
    }

    Shape <|.. Circle
    Shape <|.. Rectangle
    DrawingApp *-- Shape

Design Patterns with Class Diagrams

Class diagrams are excellent for illustrating common design patterns:

classDiagram
    class Subject {
        +attach(Observer)
        +detach(Observer)
        +notify()
    }

    class ConcreteSubject {
        -List~Observer~ observers
        +attach(Observer)
        +detach(Observer)
        +notify()
    }

    class Observer {
        <<interface>>
        +update()
    }

    class ConcreteObserver {
        +update()
    }

    Subject <|-- ConcreteSubject
    Observer <|.. ConcreteObserver
    ConcreteSubject --> Observer

Best Practices

  1. Clear Naming: Use descriptive names for classes and methods
  2. Consistent Visibility: Be consistent with access modifiers
  3. Logical Grouping: Group related classes together
  4. Show Important Details: Don't include every method, focus on key ones
  5. Use Stereotypes: Mark interfaces and abstract classes clearly

Quick Start Template

Try this simple class diagram in Mermaid Canvas:

classDiagram
    class Car {
        +String model
        +start()
        +stop()
    }

    class Engine {
        +ignite()
        +shutdown()
    }

    Car *-- Engine
Behavior Modeling

State Diagrams: Modeling System Behavior and Transitions

October 5, 2025 6 min read

Learn to create state diagrams that show how systems change from one state to another based on events, conditions, and transitions in your application flow.

Understanding State Diagrams

State diagrams (also called state machines or statecharts) show how a system behaves differently in different states. They are particularly useful for modeling reactive systems, user interfaces, and complex business processes.

Basic State Diagram Syntax

Mermaid state diagrams use a simple syntax to define states and transitions:

stateDiagram-v2
    [*] --> Idle
    Idle --> Running : start
    Running --> Idle : stop
    Running --> Error : error
    Error --> Idle : reset
    Error --> [*] : terminate

State Diagram Elements

  • States: Represent conditions or situations
  • Transitions: Arrows showing movement between states
  • Events: Triggers that cause transitions
  • Actions: Behaviors that occur during transitions
  • Initial State ([*]): Starting point
  • Final State ([*]): Ending point

Advanced State Features

State diagrams can model complex behaviors with concurrent states and history:

stateDiagram-v2
    [*] --> Authentication

    state Authentication as Auth {
        [*] --> Login
        Login --> Verifying : submit
        Verifying --> Authenticated : success
        Verifying --> Login : failure
        Authenticated --> [*]
    }

    Authentication --> Dashboard : authenticated
    Dashboard --> Authentication : logout

    state Dashboard as Dash {
        [*] --> Home
        Home --> Profile : view_profile
        Home --> Settings : view_settings
        Profile --> Home : back
        Settings --> Home : back
    }

Transition Labels and Guards

You can add conditions and actions to transitions:

stateDiagram-v2
    [*] --> Pending
    Pending --> Approved : approve[amount < 1000]
    Pending --> Review : approve[amount >= 1000]
    Pending --> Rejected : reject
    Review --> Approved : manager_approve
    Review --> Rejected : manager_reject
    Approved --> [*] : process/payment
    Rejected --> [*] : notify/reject

Practical Examples

State diagrams are excellent for modeling user interface flows:

stateDiagram-v2
    [*] --> Loading

    Loading --> Empty : no_data
    Loading --> Error : network_error
    Loading --> Ready : data_loaded

    Ready --> Loading : refresh
    Ready --> Editing : edit_item
    Editing --> Ready : save
    Editing --> Ready : cancel

    Error --> Loading : retry
    Empty --> Loading : create_first

Best Practices

  1. Clear State Names: Use descriptive names for states
  2. Logical Transitions: Ensure all transitions make sense
  3. Include Edge Cases: Don't forget error states and edge cases
  4. Use Hierarchical States: Group related states together
  5. Document Events: Clearly label transition triggers

User Interface Flow

Model your app's user flow with this state diagram in Mermaid Canvas:

stateDiagram-v2
    [*] --> Login
    Login --> Dashboard : authenticate
    Dashboard --> Profile : click_profile
    Dashboard --> Settings : click_settings
    Profile --> Dashboard : back
    Settings --> Dashboard : back
    Dashboard --> Login : logout
Data Visualization

Pie Charts and Data Visualization with Mermaid

October 6, 2025 4 min read

Create compelling pie charts and other data visualizations using Mermaid's powerful charting capabilities for reports, dashboards, and presentations.

Mermaid Chart Types

Mermaid supports various chart types for data visualization:

  • Pie Charts: Show proportions and percentages
  • Line Charts: Display trends over time
  • Bar Charts: Compare values across categories
  • Gantt Charts: Show project timelines

Creating Pie Charts

Pie charts are simple to create and show data as proportional slices:

pie title Browser Usage Statistics
    "Chrome" : 65.5
    "Firefox" : 15.2
    "Safari" : 10.3
    "Edge" : 6.8
    "Other" : 2.2

Advanced Pie Chart Features

You can customize pie charts with different styles and data formats:

pie title Monthly Revenue Breakdown
    "Product Sales" : 45.2
    "Services" : 32.8
    "Subscriptions" : 15.6
    "Licensing" : 6.4

Other Chart Types

Mermaid also supports XY charts for more complex visualizations:

xychart-beta
    title "Sales Revenue"
    x-axis [jan, feb, mar, apr, may, jun]
    y-axis "Revenue (in $)" 4000 --> 11000
    bar [5000, 6000, 7500, 8200, 9500, 10500]
    line [5000, 6000, 7500, 8200, 9500, 10500]

Quadrant Charts

Quadrant charts are useful for plotting data in four categories:

quadrantChart
    title Reach and engagement of campaigns
    x-axis Low Reach --> High Reach
    y-axis Low Engagement --> High Engagement
    quadrant-1 We should expand
    quadrant-2 Need to promote
    quadrant-3 Re-evaluate
    quadrant-4 May be improved
    Campaign A: [0.3, 0.6]
    Campaign B: [0.45, 0.23]
    Campaign C: [0.57, 0.69]
    Campaign D: [0.78, 0.34]
    Campaign E: [0.40, 0.34]
    Campaign F: [0.35, 0.78]

Best Practices for Charts

  1. Choose the Right Chart: Select the best chart type for your data
  2. Clear Titles: Always include descriptive titles
  3. Proper Labels: Label axes and data points clearly
  4. Color Coding: Use colors that enhance readability
  5. Data Accuracy: Ensure your data is accurate and up-to-date

Quick Data Visualization

Create this pie chart in Mermaid Canvas to visualize your data:

pie title Team Distribution
    "Developers" : 40
    "Designers" : 25
    "Managers" : 20
    "QA" : 15
AI Technology

AI-Powered Diagram Generation: The Future of Visual Documentation

October 7, 2025 9 min read

Explore how artificial intelligence is revolutionizing diagram creation with smart suggestions, automated layouts, and intelligent diagram completion features.

The AI Revolution in Diagramming

Artificial Intelligence is transforming how we create and work with diagrams. From intelligent layout algorithms to natural language processing for diagram generation, AI is making visual documentation more accessible and efficient than ever before.

Smart Layout Algorithms

AI-powered layout engines can automatically arrange diagram elements for optimal readability and visual flow. These algorithms consider factors like:

  • Element relationships and dependencies
  • Visual hierarchy and importance
  • Reading direction and flow patterns
  • Aesthetic spacing and alignment

Natural Language to Diagram

One of the most exciting developments is the ability to generate diagrams from natural language descriptions:

// Instead of writing complex syntax, you might soon be able to write:
"Create a flowchart showing user login process with email validation and error handling"

// And get a complete diagram automatically

Intelligent Suggestions

AI can provide contextual suggestions while you create diagrams:

  • Element Completion: Auto-complete diagram elements based on context
  • Style Suggestions: Recommend appropriate colors and styling
  • Error Detection: Identify logical inconsistencies in diagrams
  • Optimization Tips: Suggest improvements for clarity and readability

Automated Diagram Enhancement

AI can enhance existing diagrams by:

  • Adding missing connections and relationships
  • Improving layout and spacing
  • Suggesting additional elements for completeness
  • Optimizing for different output formats

Template Generation

AI can generate complete diagram templates based on common use cases:

  • System Architecture: Automatically create architectural diagrams from system descriptions
  • Process Flows: Generate workflow diagrams from process descriptions
  • Database Schemas: Create ER diagrams from data structure descriptions
  • API Documentation: Generate sequence diagrams from API specifications

Code to Diagram Conversion

AI can analyze codebases and automatically generate diagrams:

// From code like this:
class UserService {
    login(credentials) {
        // validate credentials
        // create session
        // return user data
    }
}

// AI could generate:
sequenceDiagram
    User->>UserService: login(credentials)
    UserService->>Database: validateCredentials()
    Database-->>UserService: validationResult
    UserService->>SessionManager: createSession()
    UserService-->>User: loginResponse

The Future of AI in Diagramming

As AI technology advances, we can expect:

  • Voice-to-Diagram: Create diagrams using voice commands
  • Collaborative AI: AI assistants that work with multiple team members
  • Real-time Analysis: AI that analyzes diagram effectiveness in real-time
  • Multi-modal Input: Create diagrams from sketches, photos, or existing documents

Ethical Considerations

As AI becomes more integrated into diagramming tools, it's important to consider:

  • Data Privacy: Protecting sensitive information in diagrams
  • Accuracy: Ensuring AI-generated diagrams are correct
  • Creativity: Balancing automation with human creativity
  • Accessibility: Ensuring AI tools are accessible to all users

Experience AI-Powered Diagramming

Try the latest AI features in Mermaid Canvas. Our intelligent suggestions and automated layouts help you create better diagrams faster.

Collaboration

Real-Time Collaboration: Building Diagrams Together

October 8, 2025 5 min read

Discover the power of real-time diagram editing and how it transforms team collaboration, feedback loops, and productivity in diagram creation workflows.

The Power of Real-Time Collaboration

Real-time collaboration in diagramming tools allows multiple team members to work on the same diagram simultaneously, seeing each other's changes as they happen. This eliminates version conflicts and speeds up the diagram creation process.

Key Benefits

  • Instant Feedback: Team members can provide immediate input
  • Reduced Iterations: Catch issues early in the design process
  • Knowledge Sharing: Everyone learns from each other's expertise
  • Faster Decisions: Quick consensus on design choices
  • Remote Work Friendly: Collaborate across time zones and locations

Collaboration Features

Effective real-time collaboration includes several key features:

User Presence Indicators

See who's currently viewing or editing the diagram:

  • Colored cursors for each user
  • User avatars with names
  • Active user list
  • Online/offline status

Change Tracking

Track who made what changes:

  • Change history with timestamps
  • User attribution for each edit
  • Undo/redo with conflict resolution
  • Version control integration

Communication Tools

Built-in communication features:

  • Comments and annotations
  • Voice and video calls
  • Screen sharing capabilities
  • Chat functionality

Best Practices for Collaborative Diagramming

  1. Establish Roles: Define who leads and who contributes
  2. Set Clear Goals: Know what you're trying to achieve
  3. Use Consistent Naming: Agree on terminology and conventions
  4. Regular Check-ins: Discuss progress and direction
  5. Document Decisions: Keep track of why certain choices were made

Real-Time Collaboration Workflows

Brainstorming Sessions

Use collaborative diagramming for creative brainstorming:

  • Mind mapping new ideas
  • Process flow design
  • System architecture planning
  • User journey mapping

Review and Feedback

Streamline the review process:

  • Real-time feedback on designs
  • Stakeholder approvals
  • Technical reviews
  • Client presentations

Documentation Creation

Create living documentation:

  • API documentation
  • Process documentation
  • System architecture docs
  • Training materials

Overcoming Collaboration Challenges

Managing Conflicts

Handle conflicting changes gracefully:

  • Automatic conflict resolution
  • Change merging algorithms
  • User conflict notifications
  • Manual override options

Performance Considerations

Ensure smooth collaboration experience:

  • Optimized real-time sync
  • Efficient change compression
  • Smart update batching
  • Offline mode support

Experience Collaborative Diagramming

Try creating diagrams with colleagues using Mermaid Canvas. Share your diagrams and collaborate in real-time for better team productivity.

Advanced

Advanced Mermaid Diagrams: ER, Mind Maps, and Beyond

October 9, 2025 10 min read

Explore advanced diagram types including entity-relationship diagrams, mind maps, journey diagrams, git graphs, C4 architecture, and other specialized visualizations.

Beyond Basic Diagrams

While flowcharts and sequence diagrams are essential, Mermaid offers a rich ecosystem of specialized diagram types for specific use cases and industries. These advanced diagrams help visualize complex systems, processes, and relationships.

Entity-Relationship Diagrams (ERD)

ER diagrams are crucial for database design and data modeling:

erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ LINE-ITEM : contains
    CUSTOMER {
        string name
        string custNumber
        string sector
    }
    ORDER {
        int orderNumber
        string deliveryAddress
    }
    LINE-ITEM {
        string productCode
        int quantity
        float pricePerUnit
    }

Mind Maps

Mind maps are excellent for brainstorming, organizing thoughts, and visualizing hierarchical information:

mindmap
  root((Mermaid Canvas))
    Features
      Diagrams
        Flowchart
        Sequence
        Gantt
      AI
        Generation
        Suggestions
        Auto-layout
    Benefits
      Free
      Real-time
      Export
      Collaboration

Journey Diagrams

User journey diagrams map out the complete experience of a user interacting with a product or service:

journey
    title My working day
    section Go to work
      Make tea: 5: Me
      Go upstairs: 3: Me
      Do work: 1: Me, Cat
    section Go home
      Go downstairs: 5: Me
      Sit down: 3: Me

Git Graphs

Visualize Git branching strategies and commit history:

gitgraph
    commit id: "Initial commit"
    branch develop
    checkout develop
    commit id: "Add feature A"
    branch feature-b
    checkout feature-b
    commit id: "Add feature B"
    checkout develop
    merge feature-b
    checkout main
    merge develop

C4 Architecture Diagrams

C4 diagrams provide multiple levels of architectural detail:

C4Context
    title System Context diagram for Internet Banking System

    Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
    Person(customerB, "Banking Customer B", "A customer of the bank, with personal bank accounts.")

    Person_Ext(customerC, "Banking Customer C", "A customer of the bank, with personal bank accounts.")

    System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")

    System_Ext(email_system, "E-mail system", "The internal Microsoft Exchange e-mail system.")
    System_Ext(mainframe, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")

    Rel(customerA, SystemAA, "Uses")
    Rel(SystemAA, email_system, "Sends e-mails", "SMTP")
    Rel(SystemAA, mainframe, "Uses")

Sankey Diagrams

Sankey diagrams show flow volumes between processes:

sankey-beta

%% source,target,value
Electricity grid,Over generation / storage,0.21
Electricity grid,Heating and cooling,0.15
Electricity grid,Industry,0.25
Electricity grid,Losses,0.10
Electricity grid,Transportation,0.15
Electricity grid,Residential and commercial,0.14

Timeline Diagrams

Timeline diagrams visualize events and milestones over time:

timeline
    title Mermaid Canvas Development
    2024 : Version 1.0 Released
         : Core diagram types implemented
    2025 : AI features added
         : Real-time collaboration launched
         : Advanced diagram types released

Packet Diagrams

Network packet diagrams visualize data flow in network communications:

packet-beta
    title HTTP Request Packet

    0-15: "GET"
    16-31: "HTTP/1.1"
    32-47: "Host: example.com"
    48-63: "User-Agent: Browser/1.0"

Block Diagrams

Block diagrams show high-level system architectures:

block-beta
    columns 3
    a["Input"] b["Process"] c["Output"]
    d["Data"] e["Logic"] f["Result"]

    a --> b
    b --> c
    d --> e
    e --> f

Choosing the Right Diagram Type

Selecting the appropriate diagram type depends on your communication goals:

For Data Relationships

  • ER Diagrams for database design
  • Mind Maps for brainstorming
  • Block Diagrams for system architecture

For Process Flows

  • Flowcharts for decision processes
  • Sequence Diagrams for interactions
  • Journey Diagrams for user experiences

For Project Management

  • Gantt Charts for timelines
  • Timeline Diagrams for milestones
  • Git Graphs for development workflows

For Data Analysis

  • Pie Charts for proportions
  • Sankey Diagrams for flow volumes
  • XY Charts for trends and correlations

Explore Advanced Diagrams

Try these advanced diagram types in Mermaid Canvas. Each diagram type serves specific visualization needs and can greatly enhance your communication.

ER Diagram:
Perfect for database design
Mind Map:
Great for brainstorming
C4 Diagram:
System architecture
Sankey:
Flow visualization
Integration

Export and Integration: Getting Your Diagrams Where They Need to Go

October 10, 2025 7 min read

Learn about all the ways to export your Mermaid diagrams and integrate them into your workflows, documentation, presentations, and development processes.

Export Formats and Options

Mermaid Canvas provides multiple export options to ensure your diagrams work wherever you need them:

PNG Export

High-quality raster images perfect for:

  • Presentations and slide decks
  • Reports and documentation
  • Social media sharing
  • Print materials

SVG Export (Premium)

Scalable vector graphics ideal for:

  • Web applications and responsive designs
  • High-resolution printing
  • Logo and branding materials
  • Infographics and data visualization

PDF Export (Premium)

Vector-based PDFs suitable for:

  • Professional documentation
  • Legal and compliance documents
  • Academic papers and theses
  • Technical specifications

Integration Options

Seamlessly integrate Mermaid diagrams into your existing workflows:

Documentation Platforms

  • Confluence: Embed diagrams directly in wiki pages
  • Notion: Add visual elements to your notes and databases
  • GitHub/GitLab: Include diagrams in README files and documentation
  • Docusaurus: Enhance technical documentation

Development Tools

  • VS Code: Mermaid extension for inline diagram creation
  • Jupyter Notebooks: Data visualization and analysis
  • Obsidian: Knowledge management with visual notes
  • Draw.io: Import/export compatibility

Content Management Systems

  • WordPress: Blog posts and articles with diagrams
  • Medium: Enhanced storytelling with visuals
  • Ghost: Professional blogging with diagrams
  • Strapi: Headless CMS with visual content

API Integration

Automate diagram generation and export through APIs:

// REST API Example
POST /api/diagrams/render
Content-Type: application/json

{
  "diagram": "graph TD\\n  A-->B\\n  B-->C",
  "format": "png",
  "theme": "default"
}

// Response
{
  "success": true,
  "data": {
    "url": "https://api.mermaidcanvas.app/diagrams/abc123.png",
    "expires": "2025-10-10T10:00:00Z"
  }
}

Webhooks and Automation

Set up automated workflows for diagram generation:

  • GitHub Actions: Auto-generate diagrams from code changes
  • Slack/Discord Bots: Create diagrams from chat commands
  • Zapier Integration: Connect with 3,000+ apps
  • Custom Webhooks: Trigger diagram generation from any system

Embedding Options

Embed interactive diagrams in your applications:

Direct HTML Embedding

<div class="mermaid">
graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Action 1]
    B -->|No| D[Action 2]
</div>

<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<script>mermaid.initialize({startOnLoad:true});</script>

React/Vue Components

// React Example
import { Mermaid } from 'react-mermaid';

const MyDiagram = () => (
  <Mermaid
    chart={`graph TD
      A --> B
      B --> C`}
  />
);

Version Control Integration

Keep your diagrams in sync with your code:

Git Integration

  • Store diagram source code alongside your project files
  • Use Git for version control of diagram changes
  • Track diagram evolution with your codebase
  • Include diagrams in pull request reviews

CI/CD Pipelines

  • Auto-generate documentation with embedded diagrams
  • Create diagram thumbnails for project galleries
  • Validate diagram syntax in automated tests
  • Deploy diagrams as part of your build process

Collaboration Workflows

Streamline team collaboration with integrated tools:

Shared Workspaces

  • Create team diagram libraries
  • Share diagram templates across projects
  • Maintain consistent styling and branding
  • Track diagram usage and analytics

Review and Approval Processes

  • Add comments and annotations to diagrams
  • Create review workflows for diagram changes
  • Compare diagram versions side-by-side
  • Approve and publish diagrams with proper controls

Security and Compliance

Ensure your diagrams meet security and compliance requirements:

Data Protection

  • Self-hosted options for sensitive diagrams
  • End-to-end encryption for private diagrams
  • Audit logs for diagram access and changes
  • Compliance with GDPR, HIPAA, and other regulations

Access Controls

  • Role-based permissions for diagram editing
  • Watermarking for draft and confidential diagrams
  • Time-limited sharing links
  • Integration with enterprise identity providers

Start Integrating Today

Export your first diagram and see how easy it is to integrate Mermaid Canvas into your workflow. Start with a simple PNG export and explore premium formats as your needs grow.