Skip to content

Installation

Both CDN entry points auto-load Mermaid from a CDN if it isn’t already on the page. You don’t need a separate Mermaid <script> — pick one entry point and you’re done.

Best when you’re authoring new markup:

<script src="https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/mermaid-flow-player.element.js"></script>
<mermaid-flow-player controls>
flowchart LR
A[Start] --> B[Process] --> C[End]
</mermaid-flow-player>

Best when you have existing .mermaid divs (e.g. on a docs site or blog):

<script type="module" src="https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/auto.js"></script>
<div class="mermaid">
flowchart LR
A[Start] --> B[Process] --> C[End]
</div>

auto.js waits for the DOM, ensures Mermaid is loaded, renders every .mermaid block, then adds controls + narration.

Already loading Mermaid yourself? Either entry point detects window.mermaid and uses your version instead of fetching its own.

FileURL
Web Componenthttps://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/mermaid-flow-player.element.js
Auto mode (ESM)https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/auto.js
Auto mode (IIFE)https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/auto.global.js
Auto-init (ESM)https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/auto-init.js
Full library (ESM)https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/index.js
Full library (UMD)https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/mermaid-flow-player.umd.js
CSS (optional)https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/mermaid-flow-player.css
Terminal window
npm install mermaid-flow-player
# or
pnpm add mermaid-flow-player
# or
yarn add mermaid-flow-player
<script type="module">
import { createFlowPlayer } from 'https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/index.js';
const player = createFlowPlayer({
root: document.getElementById('my-diagram'),
dim: 'others',
edgeMode: 'bestEffort',
});
await player.ready();
await player.play(player.path('A', 'B', 'C'), { speed: 1.5 });
</script>
AttributeValuesDefaultDescription
controlspresence attribute, none, or comma-separated tokens like play-pause,previous,next,speed,all-pathsall sequential controls / restart in interactive modeWhich controls to show
modesequential, interactivesequentialPlayback mode
themelight, dark, autoColor theme
speednumber (0.5-10)1.2Animation speed
narrationtrue, falsetrueShow narration area
narration-textstringInitial narration text
minimapShow minimap
edgeoff, bestEffortbestEffortEdge animation mode
visitedtrue, falsetrueTrack visited nodes
autoplayStart playing on load
debugEnable debug logging
sync-urlSync state to URL
auto-centerAuto-center on active node