Skip to content
Latestv1.0.60

AiMermaid

Renders Mermaid diagrams (flowcharts, sequence diagrams, etc.) in AI messages. Supports image/code view toggle, zoom, download, and copy.

Basic Usage

Pass Mermaid code via code; use header for the title.

Basic Usage

Diverse Diagrams

AiMermaid fully supports all Mermaid syntax, including Sequence Diagrams, Gantt Charts, Entity Relationship Diagrams, etc.

Sequence Diagram
Gantt Chart

Custom Configuration

Native Mermaid configurations can be passed via the config prop, such as changing the rendering theme. Supports presets like default, forest, dark, and neutral.

Custom Theme

Actions

Zoom, download, and copy are enabled by default; configure via actions.

Actions

Scrolling and Container Overflow

When a flowchart is too long or wide, you can scroll horizontally or vertically to view it. The nodes, edge paths, and labels inside are forced to have overflow: visible styling to ensure text is not clipped or truncated at the boundaries.

Long Flowchart Scrolling & Overflow

API

Props

PropertyDescriptionTypeDefault
codeMermaid codestring''
headerHeader (string or slot)string | object-
configMermaid configMermaidConfig{}
actionsAction bar (zoom/download/copy)MermaidActionsall enabled
classNamesExtra CSS class names per region. Keys: root / header / headerContent / extra / actions / contentRecord<string, string>-
stylesInline styles per region. Same keys as classNamesRecord<string, string>-
prefixClsCustom BEM root class prefixstring-
themeOverridesTheme overridesRecord<string, unknown>-

Events

EventDescription
render-type-changeFired when view type (image/code) changes
errorFired on render error
readyFired when render is ready

Released under the MIT License.