Showing 22 of 22 examples
Basic Flowchart
Simple top-to-bottom flowchart
graph TD;
A[Start] --> B[Process];
B --> C{Decision};
C -->|Yes| D[Result 1];
C -->|No| E[Result 2];
D --> F[End];
E --> F;Left-to-Right Flowchart
Horizontal flowchart layout
graph LR;
A[Input] --> B[Process];
B --> C[Output];Different Node Shapes
Various node shapes in flowchart
graph TD;
A[Rectangle] --> B(Rounded);
B --> C([Stadium]);
C --> D[[Subroutine]];
D --> E[(Database)];
E --> F((Circle));
F --> G>Asymmetric];
G --> H{Diamond};Basic Sequence Diagram
Simple message flow between actors
sequenceDiagram
participant Alice
participant Bob
Alice->>Bob: Hello Bob!
Bob-->>Alice: Hi Alice!Advanced Sequence
Loops, alternatives, and notes
sequenceDiagram
participant User
participant API
participant DB
User->>+API: Request Data
Note over API: Validate Request
alt Valid Request
API->>+DB: Query
DB-->>-API: Result
API-->>User: Success
else Invalid Request
API-->>User: Error
end
loop Every hour
API->>DB: Sync
endActivation Boxes
Show active periods in sequence
sequenceDiagram
participant Client
participant Server
Client->>+Server: Request
Server->>+Database: Query
Database-->>-Server: Data
Server-->>-Client: ResponseBasic Class Diagram
Simple class with properties and methods
classDiagram
class Animal {
+String name
+int age
+makeSound()
+eat()
}Class Relationships
Inheritance and associations
classDiagram
Animal <|-- Dog
Animal <|-- Cat
Animal : +String name
Animal : +makeSound()
Dog : +bark()
Cat : +meow()
Owner "1" --> "*" Animal : ownsAdvanced Class Features
Abstract classes, interfaces, and visibility
classDiagram
class Animal {
<<abstract>>
-String name
#int age
+getName()
+getAge()*
}
class Flyable {
<<interface>>
+fly()
}
Animal <|-- Bird
Flyable <|.. Bird
Bird : +fly()
Bird : +layEggs()Basic State Diagram
Simple state transitions
stateDiagram-v2
[*] --> Idle
Idle --> Running: start
Running --> Stopped: stop
Stopped --> Idle: reset
Running --> [*]: terminateComposite States
Nested states and parallel regions
stateDiagram-v2
[*] --> Active
state Active {
[*] --> Processing
Processing --> Waiting
Waiting --> Processing
}
Active --> Closed: done
Closed --> [*]Basic ER Diagram
Simple entity relationships
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
CUSTOMER }|..|{ DELIVERY-ADDRESS : usesER with Attributes
Entities with properties
erDiagram
CUSTOMER {
string name
string email
int customerId PK
}
ORDER {
int orderId PK
date orderDate
int customerId FK
}
PRODUCT {
int productId PK
string name
float price
}
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ PRODUCT : containsBasic Gantt Chart
Simple project timeline
gantt
title Project Timeline
dateFormat YYYY-MM-DD
section Planning
Research :a1, 2024-01-01, 7d
Design :a2, after a1, 5d
section Development
Frontend :b1, 2024-01-15, 10d
Backend :b2, after b1, 8d
section Testing
QA Testing :c1, after b2, 5d
Deployment :c2, after c1, 2dAdvanced Gantt
With milestones and dependencies
gantt
title Development Sprint
dateFormat YYYY-MM-DD
section Phase 1
Task A :active, a1, 2024-01-01, 3d
Task B :a2, after a1, 2d
Milestone 1 :milestone, m1, after a2, 0d
section Phase 2
Task C :crit, c1, after m1, 4d
Task D :c2, after c1, 3dBasic Pie Chart
Simple percentage distribution
pie title Market Share
"Product A" : 45
"Product B" : 30
"Product C" : 15
"Others" : 10Basic Git Graph
Simple git branch visualization
gitGraph
commit
commit
branch develop
checkout develop
commit
commit
checkout main
merge develop
commitAdvanced Git Flow
Complex branching strategy
gitGraph
commit id: "Initial"
branch develop
checkout develop
commit id: "Feature prep"
branch feature
checkout feature
commit id: "Add feature"
commit id: "Fix bug"
checkout develop
merge feature
checkout main
merge develop tag: "v1.0"
checkout develop
commit id: "Hotfix"Basic User Journey
Simple user experience flow
journey
title My Working Day
section Morning
Wake up: 3: Me
Breakfast: 4: Me
Commute: 2: Me, Cat
section Work
Meeting: 3: Me, Boss
Coding: 5: Me
Lunch: 4: Me, Colleague
section Evening
Go home: 2: Me
Relax: 5: MeBasic Requirement Diagram
System requirements visualization
requirementDiagram
requirement UserAuth {
id: 1
text: User authentication system
risk: high
verifymethod: test
}
requirement DataEncryption {
id: 2
text: Encrypt sensitive data
risk: high
verifymethod: inspection
}
element LoginPage {
type: interface
}
UserAuth - contains -> LoginPage
DataEncryption - contains -> LoginPageBasic Mindmap
Simple concept organization
mindmap
root((Project))
Planning
Research
Design
Budget
Development
Frontend
Backend
Testing
Deployment
Hosting
MonitoringBasic Timeline
Historical events timeline
timeline
title Project Milestones
2024-Q1 : Project Kickoff
: Requirements Gathering
2024-Q2 : Design Phase
: Development Start
2024-Q3 : Beta Release
: User Testing
2024-Q4 : Final Release
: Maintenance PhaseHow to Use Mermaid Diagrams
1. Copy any example code using the copy button
2. Wrap the code in a code block with the mermaid language identifier:
```mermaid
graph TD;
A-->B;
```3. Use in Markdown files and supported editors that render Mermaid diagrams
4. Learn more at mermaid.js.org