@mocanvas/editor · interface

SvgExportDef

interface SvgExportDef

A <defs> entry a shape needs present in the exported SVG — a gradient, a marker, a filter, a pattern.

Collected across every shape being exported and de-duplicated by key, so ten thousand arrows share one arrowhead marker rather than carrying one each. key is therefore the identity of the *definition*, not of the shape: two shapes returning the same key must mean the same thing by it.

getElement may be async because a definition can need something fetched — an embedded font, an inlined image — and the export waits for all of them before it serializes.


Methods · 1

getElement(): ReactNode | Promise<ReactNode>

Properties · 1

key: string

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.