Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

MermaidDiagram

A Mermaid diagram as a named picture, with a written description and its source to hand.

import { MermaidDiagram } from '@loidolt/theme-docs';

Example

stateDiagram-v2
  [*] --> Quoted
  Quoted --> Approved: proof signed
  Approved --> Cutting
  Cutting --> Finished
  Finished --> [*]
  Quoted --> Cancelled
An order is quoted, approved when the proof is signed, cut, and finished. A quote can also be cancelled.

Notes

  • label names the picture and description says what it shows — a diagram is only as accessible as its words. Until it is drawn, or if Mermaid is unavailable, the source stands in.

Props

Generated from the component source, so it cannot drift from the implementation.

MermaidDiagram props
PropTypeDefaultNotes
code required string—Mermaid source.
label required string—Names the diagram — say what it shows, e.g. "Order lifecycle".
class string—
description string—What it shows, in words, for readers who cannot see it. Shown under the diagram.
ref bindableHTMLElement | nullnull
sourceLabel string'Diagram source'Labels the disclosure holding the source.

Plus the attributes of HTMLAttributes<HTMLElement>, forwarded to the root element.