Skip to main content

Supported diagram types

Mermaid Diagrams draws every diagram type in Mermaid 12.1, the version the official Mermaid Live Editor uses. This page lists them with the first line that starts each one, the snippet to begin from, and the official syntax.

The first line of the code decides the type. For example, a diagram that starts with sequenceDiagram is a sequence diagram.

Processes and flows​

TypeFirst lineWhat it's forSnippetSyntax
Flowchartflowchart TD (or graph)Processes, decisions, workflowsFlowchart, Flowchart: Subgraphs and StylesFlowchart
Swimlaneswimlane-betaWho does what, lane by laneSwimlane ProcessSyntax reference
State diagramstateDiagram-v2Statuses and transitions, such as a work item's lifecycleState DiagramState diagram
User journeyjourneyA user's experience, step by step, with scoresUser JourneyUser journey
Agent flowagentflow-betaAI agent steps, tools and hand-offsAgent FlowAgent flow
Event modelingeventmodelingCommands, events and views over time-Event modeling

Software and data​

TypeFirst lineWhat it's forSnippetSyntax
Sequence diagramsequenceDiagramAPI calls, service interactions, sign-in flowsSequence Diagram, Sequence Diagram: API FlowSequence diagram
Class diagramclassDiagramClasses, interfaces and their relationshipsClass DiagramClass diagram
Entity relationshiperDiagramDatabase tables and relationshipsEntity Relationship Diagram, Entity Relationship Diagram: Data ModelER diagram
Use caseusecase-betaWho uses a system, and for whatUse Case DiagramUse case
Requirement diagramrequirementDiagramRequirements and what satisfies themRequirement DiagramRequirement diagram
Git graphgitGraphBranches, commits and mergesGit Graph DiagramGit graph
PacketpacketNetwork packet and message layoutsPacket DiagramPacket
Tree viewtreeView-betaFolder and file treesFolder TreeTree view
Railroadrailroad-betaGrammar and syntax rules-Railroad

Architecture​

TypeFirst lineWhat it's forSnippetSyntax
Architecturearchitecture-betaCloud and service architecture with product iconsArchitecture with IconsArchitecture
C4C4Context, C4Container, C4Component, C4Dynamic, C4DeploymentSystems at different zoom levelsC4 Context DiagramC4
Block diagramblockBlocks placed exactly where you want themBlock DiagramBlock

Architecture diagrams can use icons from two sets that ship with the app: logos: (cloud and technology logos, such as logos:aws-lambda or logos:kubernetes) and mdi: (general icons, such as mdi:server). Find names at icones.js.org. An unknown name shows a question mark.

Planning​

TypeFirst lineWhat it's forSnippetSyntax
GanttganttSchedules, release plans, dependenciesGantt Diagram, Gantt Diagram: Release PlanGantt
TimelinetimelineEvents and milestones in orderTimeline DiagramTimeline
KanbankanbanWork in columns, like a boardKanbanKanban

Ideas and analysis​

TypeFirst lineWhat it's forSnippetSyntax
Mind mapmindmapBrainstorming and topic hierarchiesMind MapMind map
Fishbone (Ishikawa)ishikawaRoot causes of a problemFishbone (Ishikawa) DiagramIshikawa
Quadrant chartquadrantChartItems on a 2Γ—2 grid, such as effort and impactQuadrant ChartQuadrant chart
Venn diagramvenn-betaOverlaps between groupsVenn DiagramVenn
Wardley mapwardley-betaValue chains and how mature each part is-Wardley
Cynefincynefin-betaSorting problems by how predictable they are-Cynefin

Charts​

TypeFirst lineWhat it's forSnippetSyntax
Pie chartpieShares of a wholePie ChartPie
XY chartxychartBar and line chartsXY ChartXY chart
Radar chartradar-betaComparing items across several measuresRadar ChartRadar
Treemaptreemap-betaHierarchical shares as nested boxesTreemapTreemap
SankeysankeyFlows between categories, such as budgetsSankey DiagramSankey

Older first lines​

Code written for earlier Mermaid versions still works. These first lines are accepted too: graph, flowchart-elk, stateDiagram, classDiagram-v2, requirement, and the -beta forms of types that are no longer in beta, such as xychart-beta, sankey-beta, block-beta and packet-beta.