Skip to content

serializeSvg

function serializeSvg(svg, options?): string;

Defined in: packages/core/src/export/serializeSvg.ts:39

Serializes a rendered <svg> to a standalone SVG document. The library styles SVG partly with class-based CSS and theme variables (currentColor, var(--background)), none of which travel with the markup — so the computed style of every element is inlined first, and the result looks the same outside the page. Interactive-only elements (invisible hit areas) are dropped.

Parameter Type
svg SVGSVGElement
options SerializeSvgOptions

string