The Mermaid component renders diagrams, flowcharts, sequence diagrams, and other visualizations using Mermaid.js syntax.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/devscribe-team/webeditor/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Mermaid components support a wide variety of diagram types:- Flowcharts and flow diagrams
- Sequence diagrams
- Class diagrams
- State diagrams
- Entity relationship diagrams
- Gantt charts
- Pie charts
- Git graphs
Insertion
Insert a Mermaid diagram using the command menu:- Type
/to open the command menu - Search for “mermaid” or “diagram”
- Select the Mermaid option
Attributes
The Mermaid diagram code. Must be valid Mermaid.js syntax. The editor validates syntax when you save.
Controls the maximum width and height of the rendered diagram:
sm: Small (300px × 200px max)md: Medium (500px × 300px max)lg: Large (700px × 400px max)xl: Extra large (900px × 500px max)full: Full width (100% × 600px max)
Whether to display a border around the diagram. Toggle using the border button in the toolbar.
Node specification
Usage examples
Basic flowchart
Sequence diagram
State diagram
Class diagram
Entity relationship diagram
Gantt chart
Editing in the editor
The Mermaid component provides a powerful editing experience:Toolbar (appears on hover)
- Edit button: Opens the code editor modal
- Border button: Toggles diagram border visibility
- Copy button: Copies the Mermaid code to clipboard
Keyboard shortcuts in modal
Ctrl+Enter: Save and closeEscape: Cancel and close
TypeScript types
Mermaid configuration
The editor initializes Mermaid with these default settings:Error handling
If the Mermaid code has syntax errors:- The editor validates code when you save in the modal
- Error messages appear in the modal
- Invalid diagrams show an error state with the error message
- You must fix errors before saving
Best practices
- Start simple: Begin with basic diagrams and add complexity gradually
- Use meaningful labels: Make node and edge labels clear and descriptive
- Choose the right diagram type: Use flowcharts for processes, sequence for interactions, etc.
- Keep it focused: Don’t try to show everything in one diagram
- Test syntax: Use the Mermaid Live Editor to prototype complex diagrams
- Size appropriately: Match diagram size to complexity and page layout
For complex diagrams, start with the
lg or xl size to ensure all details are visible. You can always adjust the size later.Diagram syntax resources
Learn more about Mermaid syntax:- Official Documentation
- Flowchart Syntax
- Sequence Diagram Syntax
- Class Diagram Syntax
- State Diagram Syntax
- ER Diagram Syntax
- Gantt Chart Syntax
Common issues
Diagram not rendering
- Check for syntax errors in your Mermaid code
- Ensure quotes and brackets are properly matched
- Verify that node IDs don’t contain special characters
Diagram too small/large
- Use the size selector to choose a different preset
- For very large diagrams, use the
fullsize option - Consider splitting complex diagrams into multiple smaller ones
Styling looks wrong
- The editor uses a dark theme by default
- Diagrams automatically scale to fit their container
- Border visibility can be toggled with the toolbar button