Header layout
A bar above each diagram holds its title and the copy, download and fullscreen buttons. Mermaid and hand-written SVG diagrams get the same bar.
Live diagrams
Core infrastructure
MermaidAPI report flow
MermaidState transition
Inline SVGNo viewBox attribute
Inline SVGAnalytics
MermaidPerformance stress test
2,500 nodesClick or tap to open the 2,500 node grid.
Remember zoom
MermaidThis page sets rememberZoom: true. Open this diagram, zoom, pan or
rotate, then close it. Open it again and it comes back the same way. A page reload starts
fresh.
Meeting mode and share links
MermaidIn fullscreen, press M for a red dot that follows your pointer, and the cursor hides. Press L to copy a link that opens this diagram at the same zoom, position and rotation. Both are also in the ☰ menu.
Security: an inline handler
Inline SVGThe node carries an onclick handler. Open the diagram fullscreen and click the
node. DiagView cleans the copy it shows in fullscreen, not the diagram on this page.
Strict and Permissive both remove every on* attribute from that
copy, so the click does nothing. Off keeps the SVG as written, so the handler runs.
The node fills with the accent colour and the label reads "Handler ran".
DiagView makes a fresh copy each time fullscreen opens, so a new Security choice applies from the next open. Strict also drops SMIL animation and CSS that could run script or load remote files. Permissive keeps both, apart from animations that rewrite links or handlers.
Why choose this layout?
Pick it when every diagram needs a visible title.
A toolbar above each diagram
A bar above each diagram holds the title and the copy, download and fullscreen buttons. With a mouse it appears on hover or keyboard focus. On touch screens it is always shown.
Keyboard and screen reader ready
Every button has a label and a visible focus ring, and the whole toolbar works from the keyboard.
A title on every diagram
The bar shows each diagram's data-title. Exported files get the same
name.
Keyboard reference
Tab reaches the toolbar buttons, and these keys work while the viewer is open.
Zoom
- +
- Zoom in
- -
- Zoom out
- Space / 0
- Reset & center
Pan
- ↑ ↓ ← →
- Pan
- Shift + ↑ ↓ ← →
- Fast pan
- Drag
- Free pan
Search
- F
- Open search
- Esc
- Clear / close
Tools
- M
- Meeting mode
- R
- Rotate 90°
- L
- Share link
- T
- Text select
- ?
- Show shortcuts
Integration
Render Mermaid first, then start DiagView.
// With Mermaid, render it first
await mermaid.run();
DiagView.init({
diagramSelector:
'.mermaid, .diagram',
layout: 'header',
showKeyboardHelp: true,
highResScale: 4
});
<!-- Or set it for one diagram -->
<div
class="mermaid"
data-diagview-layout="header"
>
graph TD; A-->B;
</div>