Skip to content

ExportPngParams

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

Parameters for exportPng (from the sfn-diagram/png subpath).

aslDefinition: string | AslDefinition;

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

ASL definition as object or JSON string


optional backgroundColor?: string;

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

Background color for PNG export

'transparent'

DiagramOptions.backgroundColor


optional catchHandling?: CatchHandling;

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

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


optional catchLabelStyle?: CatchLabelStyle;

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

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

'error-type'

DiagramOptions.catchLabelStyle


optional collapse?: boolean | string[];

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

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


optional collapseControls?: boolean;

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

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


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

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

Custom styling overrides for specific state types

DiagramOptions.customColors


optional diagramDescription?: string;

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

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

DiagramOptions.diagramDescription


optional diagramTitle?: string;

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

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


optional edgeHitAreas?: boolean;

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

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


optional edgeOverrides?: Record<string, EdgeStyleOverride>;

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

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 through 1.x; removal is deferred to 2.0.

When both match an edge, the qualified key is merged on top of the bare one.

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

DiagramOptions.edgeOverrides


optional edgeStyle?: EdgePathStyle;

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

Style of edge paths: straight, curved, or orthogonal

'curved'

DiagramOptions.edgeStyle


optional engine?: PngEngine;

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

Rasterization engine. resvg is a native, browser-free renderer; html-to-image launches headless Chromium via Puppeteer and is kept as an opt-in fallback.

'resvg'
PngExportOptions.engine

optional fontDirs?: string[];

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

Directories to search for font files. resvg only.

PngExportOptions.fontDirs

optional fontFamily?: string;

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

Font family to use for text rendering, overriding automatic detection. resvg only.

PngExportOptions.fontFamily

optional fontFiles?: string[];

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

Explicit font files to load. resvg only.

PngExportOptions.fontFiles

optional format?: DiagramFormat;

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

Output format for the diagram

DiagramOptions.format


optional height?: number;

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

Overall diagram height in pixels (auto-calculated if not specified)

DiagramOptions.height


optional iconPosition?: "left" | "top" | "right";

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

Position of AWS service icons relative to node label

'left'

DiagramOptions.iconPosition


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

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

Custom function to resolve icon URLs for services

string

string | null

DiagramOptions.iconResolver


optional iconSize?: number;

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

Size of AWS service icons in pixels

24

DiagramOptions.iconSize


optional includeComments?: boolean;

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

Whether to use state comments as node labels

true

DiagramOptions.includeComments


optional layout?: LayoutDirection;

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

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

DiagramOptions.layout


optional nodeAnnotations?: Record<string, string>;

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

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. Used by the execution overlay to show per-state duration and retry counts.

DiagramOptions.nodeAnnotations


optional nodeHeight?: number;

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

Height of each state node in pixels

60

DiagramOptions.nodeHeight


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

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

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. Merged on top of the node’s computed style — only specified fields are overridden.

DiagramOptions.nodeOverrides


optional nodeSeparation?: number;

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

Horizontal separation between nodes in pixels

50

DiagramOptions.nodeSeparation


optional nodeWidth?: number;

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

Width of each state node in pixels

120

DiagramOptions.nodeWidth


optional padding?: number;

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

Padding around the diagram in pixels

20

DiagramOptions.padding


optional pngQuality?: number;

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

PNG export quality from 1-100.

Has no effect on the default resvg engine (PNG is lossless, and resvg exposes no compression knob) or on the html-to-image fallback engine (its quality option is JPEG-only). Retained for backward compatibility. Use PngExportOptions.scale to control output resolution instead.

90

DiagramOptions.pngQuality


optional rankSeparation?: number;

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

Vertical separation between ranks in pixels

50

DiagramOptions.rankSeparation


optional scale?: number;

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

Multiplier applied to the diagram’s rendered size. resvg only.

1
PngExportOptions.scale

optional showIcons?: boolean;

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

Whether to display AWS service icons on Task state nodes

false

DiagramOptions.showIcons


optional showStateTypes?: boolean;

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

Whether to display state type labels on nodes

false

DiagramOptions.showStateTypes


optional showVariables?: boolean;

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

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


optional stylePreset?: StylePreset;

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

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

'aws-standard'

DiagramOptions.stylePreset


optional theme?: ThemeOption;

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

Color theme: ‘light’, ‘dark’, or custom theme object

DiagramOptions.theme


optional width?: number;

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

Overall diagram width in pixels (auto-calculated if not specified)

DiagramOptions.width