Skip to content

Function: toMermaidVariants()

ts
function toMermaidVariants(variants, options?): string;

Defined in: packages/core/src/mermaid.ts:215

Convert a component's alternative StructureVariants (from top-level @variant blocks) to a single Mermaid flowchart — one labelled subgraph per variant (reusing the same mechanism @scope boundary nodes use), read top-to-bottom as "pick one of these". An unlabelled variant is titled "Variant N" (1-based, in authored order).

Parameters

variants

readonly object[]

The component's StructureVariants.

options?

MermaidOptions = {}

MermaidOptions.

Returns

string

Mermaid source, or an empty string when there are no variants with nodes.

Released under the MIT License