MermaidDiagram

Markdown

Mermaid diagrams with zoom and a source view, and a clear message when one can’t be drawn.

Use it for
A diagram written in Mermaid, with zoom and source view.
Not for
Interactive workflows. Try WorkflowGraph.

MermaidDiagram preview

Loading example…

Installation

npm install @stackunseen/ui mermaid dompurify
import { MermaidDiagram } from '@stackunseen/ui/mermaid';
Styles: @stackunseen/ui/styles.css

Usage and props

Display a Mermaid diagram with its source available to read. This is a diagram viewer; handle editing and workflow execution in your application. Needs the Mermaid package. Diagrams can’t change settings, add click actions or load anything from other sites.

codestring
Mermaid source. Restricted, unsupported or invalid input shows a source preview and message.
titlestring (optional)
The diagram title. Defaults to Diagram.
descriptionstring (optional)
A short explanation of what the diagram shows.
state'complete' | 'streaming' (optional)
Use streaming while source is arriving, then complete when it is ready to render.
How state and callbacks work
All props

Loading…

For your coding agent

Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.

Contract
code · title? · description? · state? · variant
Keeps honest
Needs the Mermaid package. Diagrams can’t change settings, add click actions or load anything from other sites.
MCP
read_component "MermaidDiagram" on the docs endpoint
Open the Markdown file

Keyboard and customization

Keyboard

Tab reaches the source disclosure and diagram controls. Use the source view as an alternative to reading the diagram.

Customization

Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio