flowchart LR
A[Code block] --> B[Parsed]
B --> C[Rendered]
<mermaid-element>
<code>flowchart LR
A[Code block] --> B[Parsed]
B --> C[Rendered]</code>
</mermaid-element>
Download Back To CSSScript.Com
Render Mermaid syntax as an interactive SVG custom element with live versions, reactive updates, event hooks, and Shadow DOM styling.
A declarative child node becomes an SVG diagram inside an encapsulated custom element.
<mermaid-element theme="dark">
flowchart LR
Request[Request] --> Element[Custom element]
Element --> Loader[Mermaid module]
Loader --> SVG[Rendered SVG]
SVG --> Shadow[Open Shadow Root]
</mermaid-element>
Each source keeps the same rendering surface while the child node changes.
flowchart LR
A[Code block] --> B[Parsed]
B --> C[Rendered]
<mermaid-element>
<code>flowchart LR
A[Code block] --> B[Parsed]
B --> C[Rendered]</code>
</mermaid-element>
<mermaid-element>
<template>flowchart LR
A["Literal <tag>"] --> B["Safe text"]
B --> C[SVG]</template>
</mermaid-element>
stateDiagram-v2
[*] --> Idle
Idle --> Active : start
Active --> [*] : finish
<mermaid-element>
<pre>stateDiagram-v2
[*] --> Idle
Idle --> Active : start
Active --> [*] : finish</pre>
</mermaid-element>
Switch diagram families, Mermaid releases, themes, and source code. The preview listens to the component events.
Edit the input, then watch one in-memory module cache feed repeated renders.
Use attributes in HTML, properties in JavaScript, or call render() directly.
These controls operate on one live element instance.
<mermaid-element theme="dark">
child text → observer → SVG
</mermaid-element>
Trigger a syntax error, recover it, and inspect the exposed styling part.
The host page styles the internal container without reaching into the shadow tree.