Skip to content

GenerateMermaidParams

Defined in: src/types/index.ts:987

Parameters for generateMermaid.

aslDefinition: string | AslDefinition;

Defined in: src/types/index.ts:989

ASL definition as object or JSON string


backgroundColor?: string;

Defined in: src/types/index.ts:578

Background color for PNG export

'transparent'

DiagramOptions.backgroundColor


catchHandling?: CatchHandling;

Defined in: src/types/index.ts:586

How to treat per-state Catch (error-handler) branches. ‘show’ (default) renders them; ‘hide’ drops error edges and handler-only nodes so the happy path reads clearly on large machines.

'show'

DiagramOptions.catchHandling


catchLabelStyle?: CatchLabelStyle;

Defined in: src/types/index.ts:592

Style for Catch block edge labels: ‘error-type’ shows error names, ‘catch-number’ shows “Catch #N”

'error-type'

DiagramOptions.catchLabelStyle


collapse?: boolean | string[];

Defined in: src/types/index.ts:602

Collapse Parallel/Map containers into a placeholder node so dagre lays out a smaller graph — hiding a container’s children shrinks the diagram instead of leaving an empty bounding box behind. true collapses every container; a string array collapses only the named containers (names that don’t resolve to an existing container are ignored).

undefined (no collapsing)

DiagramOptions.collapse


collapseControls?: boolean;

Defined in: src/types/index.ts:614

Draw a collapse control in every open container’s header and an expand control on every collapsed placeholder, each tagged data-sfn-collapse-target="<id>", for the interactive viewer’s per-container collapse.

Only useful for interactive output — generateHtml sets it for itself when it embeds the in-browser relayout. It stays off by default so static SVG and PNG export carry no controls.

false

DiagramOptions.collapseControls


customColors?: Partial<Record<StateType, Partial<NodeStyle>>>;

Defined in: src/types/index.ts:623

Per-state-type fill and stroke, applied on top of the theme. Only fill and stroke are drawn; shape and strokeWidth here have no effect (use nodeOverrides). In Mermaid output a value that can’t be drawn on one style line (a line break, ;, {, }, or a comma outside rgb()/hsl() syntax) is left out with a %% comment, and the theme’s colour shows instead.

DiagramOptions.customColors


diagramDescription?: string;

Defined in: src/types/index.ts:629

Accessible description for the diagram, rendered as the root <svg>’s <desc>. Falls back to a state/transition count summary when omitted.

DiagramOptions.diagramDescription


diagramTitle?: string;

Defined in: src/types/index.ts:637

Accessible name for the diagram, rendered as the root <svg>’s <title> and aria-label. generateSvg defaults it from the ASL definition’s top-level Comment when omitted.

'AWS Step Functions state machine diagram'

DiagramOptions.diagramTitle


edgeHitAreas?: boolean;

Defined in: src/types/index.ts:648

Render an invisible, thicker hit area beneath every edge so pointer events land on a comfortable target rather than on the drawn stroke, which is 1.5–2px wide.

Only useful for interactive output — generateHtml and the sfn-diagram/element custom element set it themselves so edges are clickable in the viewer. It stays off by default so static SVG and PNG export carry no extra paths.

false

DiagramOptions.edgeHitAreas


edgeOverrides?: Record<string, EdgeStyleOverride>;

Defined in: src/types/index.ts:803

Per-edge style overrides. Merged on top of the edge’s computed style — only specified fields are overridden. Used by the execution overlay to highlight taken transitions and dim untaken ones.

Two key shapes are accepted:

  • GraphEdge.id — ${from}->${to}#${type}#${ordinal}, e.g. Route->Work#choice#1. Targets exactly one edge. Prefer this.
  • ${from}->${to} — legacy, broad-matches every edge between that pair. Kept for backwards compatibility; 2.0 keeps it too.

When both match an edge, the qualified key is merged on top of the bare one. from and to are node ids, so a state name holding a character XML 1.0 forbids appears with U+FFFD in its place; read the key off the rendered data-edge-id.

{
'Route->Work': { strokeWidth: 2 }, // both branches
'Route->Work#choice#1': { stroke: '#d13212' }, // only the second rule
}

DiagramOptions.edgeOverrides


edgeStyle?: EdgePathStyle;

Defined in: src/types/index.ts:654

Style of edge paths: straight, curved, or orthogonal

'curved'

DiagramOptions.edgeStyle


format?: DiagramFormat;

Defined in: src/types/index.ts:657

Output format for the diagram

DiagramOptions.format


iconPosition?: IconPosition;

Defined in: src/types/index.ts:663

Position of AWS service icons relative to node label

'left'

DiagramOptions.iconPosition


iconResolver?: (service) => string | null;

Defined in: src/types/index.ts:666

Custom function to resolve icon URLs for services

string

string | null

DiagramOptions.iconResolver


iconSize?: number;

Defined in: src/types/index.ts:672

Size of AWS service icons in pixels

24

DiagramOptions.iconSize


idPrefix?: string;

Defined in: src/types/index.ts:696

String prepended to every id the SVG emits (the arrowhead <marker> ids) and to every url(#...) reference to one. Ids are document-global, so two SVGs inlined in one HTML page must not share them, or the second diagram’s edges resolve to the first diagram’s markers.

By default each render prefixes its marker ids with sfn- and eight hex digits hashed from the rest of its output (sfn-1a2b3c4d-arrowhead-normal), so different diagrams on one page never share ids and re-rendering the same input gives the same ids. Two renders of the same definition with the same options get the same prefix, so pass your own to tell such copies apart. '' gives bare ids.

Letters, digits, _, -, ., : and non-whitespace non-ASCII characters only, so React’s useId() values work as-is; anything else throws. The prefix is prepended verbatim, so end it with a separator ('orders-'). Has no effect on Mermaid output or on layout.

a hash-derived sfn-xxxxxxxx- prefix

generateSvg({ aslDefinition, idPrefix: 'orders-' }); // id="orders-arrowhead-normal"
generateSvg({ aslDefinition, idPrefix: '' }); // id="arrowhead-normal"

DiagramOptions.idPrefix


includeComments?: boolean;

Defined in: src/types/index.ts:704

Whether to use state comments as node labels. In SVG and PNG output a label wider than its node is cut short with …; the full text stays in the node’s <title> tooltip.

true

DiagramOptions.includeComments


layout?: LayoutDirection;

Defined in: src/types/index.ts:707

Graph layout direction: TB (top-bottom), LR (left-right), RL (right-left), BT (bottom-top)

DiagramOptions.layout


nodeAnnotations?: Record<string, string>;

Defined in: src/types/index.ts:810

Extra annotation text rendered below a node’s label, keyed by graph node id - the state name for every state whose name is unique across the machine. For a nested state whose name repeats elsewhere in the machine the id is qualified by its scope, so read it off the rendered data-state-id rather than assuming the bare name. A character XML 1.0 forbids in a name becomes U+FFFD in its id, so read those off data-state-id too. Used by the execution overlay to show per-state duration and retry counts.

DiagramOptions.nodeAnnotations


nodeHeight?: number;

Defined in: src/types/index.ts:713

Height of each state node in pixels

60

DiagramOptions.nodeHeight


nodeOverrides?: Record<string, Partial<NodeStyle>>;

Defined in: src/types/index.ts:778

Per-node style overrides keyed by graph node id, which is the state name for every state whose name is unique across the machine. For a nested state whose name repeats elsewhere in the machine the id is qualified by its scope, so read it off the rendered data-state-id rather than assuming the bare name. A character XML 1.0 forbids in a name becomes U+FFFD in its id, so read those off data-state-id too. Merged on top of the node’s computed style — only specified fields are overridden.

DiagramOptions.nodeOverrides


nodeSeparation?: number;

Defined in: src/types/index.ts:719

Horizontal separation between nodes in pixels

50

DiagramOptions.nodeSeparation


nodeWidth?: number;

Defined in: src/types/index.ts:726

Width of each state node in pixels. Names and Comments wider than this are truncated with …, so widen nodes for long labels.

120

DiagramOptions.nodeWidth


padding?: number;

Defined in: src/types/index.ts:732

Padding around the diagram in pixels

20

DiagramOptions.padding


rankSeparation?: number;

Defined in: src/types/index.ts:738

Vertical separation between ranks in pixels

50

DiagramOptions.rankSeparation


showIcons?: boolean;

Defined in: src/types/index.ts:744

Whether to display AWS service icons on Task state nodes

false

DiagramOptions.showIcons


showStateTypes?: boolean;

Defined in: src/types/index.ts:750

Whether to display state type labels on nodes

false

DiagramOptions.showStateTypes


showVariables?: boolean;

Defined in: src/types/index.ts:758

Whether to annotate nodes with the variables they assign via ASL Assign. Shown as $var1, $var2 beneath the node label. States that assign nothing are unaffected.

true

DiagramOptions.showVariables


stylePreset?: StylePreset;

Defined in: src/types/index.ts:764

Visual style preset: ‘aws-standard’ uses rectangles (AWS parity), ‘enhanced’ uses shapes for visual distinction

'aws-standard'

DiagramOptions.stylePreset


theme?: ThemeOption;

Defined in: src/types/index.ts:771

Color theme: ‘light’, ‘dark’, ‘auto’, or a custom theme object. 'auto' repaints in the dark palette under prefers-color-scheme: dark and renders as light in PNG and Mermaid output; see ThemeOption.

DiagramOptions.theme