Design API
kittl.design gives you access to editor design operations. In the app sandbox, all calls are async.
API groups
The design namespace is organized by capability:
board- create and update artboardstext- add and update text objectsshape- create/update predefined or basic shapesimage/illustration/video/videoboard- media object workflowsobject- generic object utilities (remove, lock, hide, rotate, rename, get)layers/group- stacking and grouping operationscanvas- previews and exportsconfig/state/texture/guide/loadingCard- specialized editor state APIs
Example: create and select text
const addResult = await kittl.design.text.addText({
text: 'Launch campaign',
position: { absolute: { left: 140, top: 120 } },
size: { width: 360, height: 80 },
textProperties: {
fontSize: 48,
fill: '#111111',
textAlign: 'left',
},
});
if (addResult.isOk) {
await kittl.state.setSelectedObjectsIds([addResult.result.id]);
}
Example: artboard + shape workflow
const boardResult = await kittl.design.board.createStandardBoard({
title: 'Social post',
position: { absolute: { left: 100, top: 100 } },
size: { width: 1080, height: 1080 },
});
if (boardResult.isOk) {
const board = boardResult.result;
await kittl.design.shape.createPredefinedShape({
shapeType: 'rectangle',
position: { relative: { to: board.id, location: 'center' } },
size: { width: 920, height: 920, applyViewportScale: false },
objectProperties: { fillColor: '#f4f4f4' },
});
}
Notes
- All design API methods return
SdkResult; checkisOkand useresultbefore accessing values. - Use object IDs returned by SDK methods to chain operations safely.
- Prefer feature-specific namespaces (
text,shape,board) over generic object methods when possible.
Applying Design State
kittl.design.state.implementSubState(params) applies a partial design state. The input is Partial<NormalizedDesignState> and the SDK result contains the applied partial state. See NormalizedDesignState and the StateAPI declaration.
Reading Design State
kittl.design.state.getState() reads the full normalized design state in an SDK result. It was added in SDK 0.0.2. The state includes objects, boards, group structures, ordering indices, and design configuration; see NormalizedDesignState.