React Sketch Canvas
APIInterfaces

CanvasRef

Defined in: Canvas/types.ts:231

Imperative ref API exposed by the low-level Canvas component.

Extended by

Properties

exportImage

exportImage: (imageType, options?) => Promise<string>

Defined in: Canvas/types.ts:243

Export the current canvas as a raster image data URL.

Parameters

imageType

ExportImageType

Image format to create.

options?

ExportImageOptions

Optional export dimensions.

Returns

Promise<string>

Promise that resolves to a data:image/* URL.

Remarks

The output includes the currently rendered strokes. Background image export depends on the exportWithBackgroundImage prop.


exportSvg

exportSvg: () => Promise<string>

Defined in: Canvas/types.ts:256

Export the current canvas as SVG markup.

Returns

Promise<string>

Promise that resolves to SVG markup.

Remarks

The returned string contains the cloned SVG element after export-specific background handling has been applied.

On this page