Skip to main content

Design system components

Mermaid

Renders a Mermaid diagram with a concise accessible name, prose summary, and visible structured text alternative.

Status: alpha. Group: media. Markdown version: /design-system/components/mermaid.md

When to use

Renders a Mermaid diagram with a concise accessible name, prose summary, and visible structured text alternative.

When not to use

  • Do not render a diagram without a complete accessibleDetails equivalent.
  • Do not use title alone as the text alternative for a diagram with meaningful relationships.

Look-alikes

The contract names no look-alike with a deciding condition.

Props

Mermaid props
PropTypeDefaultDescriptionRequired
chartstringnoneMermaid diagram source.Yes
titlestringnoneConcise meaningful name for the diagram.Yes
descriptionstringnoneShort prose summary of the diagram purpose and relationships.Yes
accessibleDetailsReactNodenoneStructured or prose equivalent of every material relationship in the diagram.Yes
detailsLabelstringnoneLabel for the visible text-alternative disclosure.No
captionstringnoneOptional visible figure caption.No
classNamestringnoneAdditional className for the figure.No
themeColorsMermaidThemeColorsnoneDiagram color overrides: CSS colours or var(--token) references. Defaults to --color-text and --color-border, so diagrams follow the theme.No

Variants

No variant dimensions and no props with a fixed set of values.

Invalid combinations

The contract records no invalid combinations.

Keyboard

Mermaid keyboard behaviour
KeyBehaviour
TabFocuses the native disclosure summary.
Enter or SpaceToggles the text alternative.

Rules

Every item under When not to use is a MUST NOT. MUST and SHOULD follow RFC 2119.

Mermaid rules
LevelRuleHow it is checked
MUSTARIA: The rendered diagram has role img and is named by title.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTARIA: Description supplies a concise accessible description.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTARIA: Aria-details points to a visible disclosure containing a complete structured or prose equivalent of the diagram relationships.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTARIA: The generated SVG is hidden from assistive technology to prevent duplicate, unstructured narration.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTRequired stories produce no axe violations at the configured severity.Automated by npm run test:stories:matrix:ci. WCAG 2.5.8.
MUSTThe accessibility tree (role, name, state) matches the committed snapshot for every required story.Automated by npm run test:stories:matrix:ci. WCAG 1.3.1, 4.1.2.
MUSTThe component remains legible and operable under a real browser forced-colors: active pass.Automated by npm run test:stories:hc.
MUSTEvery documented keyboard interaction works as specified.Not yet verified: no evidence record. WCAG 2.1.1, 2.1.2.

Install and import

  • In-repo only. Mermaid is not exported from @digitaltableteur/react, so there is no public import path.
  • Alpha components are internal and never exported.