Skip to main content

Design system components

MarkdownMessage

Markdown renderer (GFM, raw HTML skipped) for chat replies and long-form content; it renders plain HTML elements by default and maps them onto Title, Text and Link only with renderWithDesignSystem.

Status: stable. Group: structure. Markdown version: /design-system/components/markdown-message.md

When to use

Markdown renderer (GFM; raw HTML is skipped) for chat replies and long-form content. By default it renders plain p, h1-h3, a, strong and em elements styled by its own stylesheet; set renderWithDesignSystem to map them onto Title, Text and Link instead. Code and block code always render as plain code and pre elements, and density=chat drops images.

When not to use

The contract records no forbidden uses.

Look-alikes

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

Props

MarkdownMessage props
PropTypeDefaultDescriptionRequired
contentstringnoneMarkdown source. Rendered through DS typography only when renderWithDesignSystem is set.Yes
fallbackstringnonePlain text shown when content is empty after trimming. There is no parse-failure path.No
data-rolestringnoneNo description in the contract.No
renderWithDesignSystembooleanfalseRender markdown using the design system components (Title/Text/Link). Useful for long-form content pages to ensure consistent styling. Defaults to false, which renders raw p, h1-h3, a, strong and em elements; code and pre stay plain elements in both modes.No
designSystemTextSizeDesignSystemTextSizemWhen renderWithDesignSystem is enabled, use this as the base size for paragraph and inline emphasis text (e.g. p, strong, em). Defaults to m.No
density"default" | "chat"defaultCompact typography for in-chat assistant replies. Defaults to default; chat also drops every image.No

Variants

  • Available densities: default, chat (default default).

Invalid combinations

The contract records no invalid combinations.

Keyboard

MarkdownMessage keyboard behaviour
KeyBehaviour
TabReaches rendered links and block code; a pre is focusable (tabIndex 0) so its horizontal scroll is keyboard-reachable.

Rules

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

MarkdownMessage rules
LevelRuleHow it is checked
MUSTARIA: The root is an aria-live=polite region for the whole lifetime of the instance, so a reply that streams into an existing, initially empty instance is announced; content present at mount is not announced.Not yet verified: no evidence record. WCAG 4.1.2.
MUSTARIA: Density=chat drops every image; otherwise markdown images render as lazy img elements with their alt text (empty when the markdown gives none)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.
MUSTA human completed an end-to-end accessibility review of this component.Manual review, last on 2026-11-04.
MUST NOTMaintainers: Do not bypass design tokens or skip forced-colors verification at beta.Release review; not machine-checked.

Install and import

  • In-repo only. MarkdownMessage is not exported from @digitaltableteur/react, so there is no public import path.