Skip to content

Auto Modes

There are five entry points, each tuned for a different starting point. The first two are zero-config and one-script — both auto-load Mermaid from a CDN if it isn’t already on the page.

EntryBest forLoads Mermaid?
mermaid-flow-player.element.jsNew markup using <mermaid-flow-player>Yes (if missing)
auto.jsExisting .mermaid divs you want to upgradeYes (if missing)
auto-init.jsDiagrams you’ve already rendered yourselfNo — assumes Mermaid present
auto-enhance.jsdata-flow-* attribute-driven scenariosNo
auto-play.jsAutoplay on load / scroll / clickNo
import { createFlowPlayer } from 'https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/index.js';
const player = createFlowPlayer({
root: document.getElementById('diagram'),
});
await player.ready();
await player.play(player.path('Start', 'Process', 'Check'));
import { autoPlay } from 'https://cdn.jsdelivr.net/npm/mermaid-flow-player@latest/auto-play.js';
autoPlay({
trigger: 'scroll',
speed: 1.5
});
TriggerBehavior
'load'Plays immediately
'scroll'Plays when scrolled into view
'click'Plays on click
<mermaid-flow-player data-flow-scenario="A,B,C">
graph LR
A --> B --> C
</mermaid-flow-player>
AttributeDescription
data-flow-scenarioComma-separated node IDs
data-flow-speedSpeed multiplier
data-flow-narrationNarration text
ModeUse Case
<mermaid-flow-player>Quick demos
createFlowPlayer()Production control
autoPlay()Presentations
data-flow-*Selective enhancement