Canvas API Reference
kittl.design.canvas — previews and screenshots.
Scope: design:state:read
getPreviewImage(id)
Returns a preview image URL for a given board.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Board ID to preview |
Returns: SdkResultAsync<string | null> — a data URL, hosted asset URL, or null when unavailable.
getScreenshot()
Captures a screenshot of the current canvas viewport.
Returns: SdkResultAsync<{ data: string; width: number; height: number }>
getExport(options)
Generates a canvas export with GetExportOptions. The options include the output format, target board or node IDs, and optional dimensions and rendering settings. It returns SdkResultAsync<Blob | null>.
const exported = await kittl.design.canvas.getExport({
format: 'png',
target: { boardId: 'board-id' },
});
if (exported.isOk && exported.result) {
console.log('Exported bytes:', exported.result.size);
}