Text API Reference
kittl.design.text — add and update text elements.
Scope: design:state:write
addText(params)
Adds a new text element to the canvas.
| Property | Type | Required | Description |
|---|---|---|---|
text | string | Yes | The text content |
position | AbsolutePosition | RelativePosition | Yes | Placement on canvas |
size | { width, height, applyViewportScale? } | No | Text box dimensions |
textProperties | TextProperties | No | Styling (see below) |
Returns: SdkResultAsync<NormalizedRichTextObject>
updateText(params)
Updates an existing text element.
| Property | Type | Required | Description |
|---|---|---|---|
textId | string | Yes | ID of the text to update |
text | string | No | New text content |
left | number | No | X position |
top | number | No | Y position |
angle | number | No | Rotation in degrees |
| ...TextProperties | No | Any TextProperties field |
updateRenderPlugin(params)
Updates a render plugin (e.g. shadow) on a text element.
| Property | Type | Required | Description |
|---|---|---|---|
textId | string | Yes | ID of the text element |
renderPluginId | string | Yes | ID of the render plugin |
renderPlugin | Partial<RichTextRenderPluginSerializedObject> | Yes | Plugin properties to update |
Render Plugin Properties
| Property | Type | Description |
|---|---|---|
name | string | Plugin name/type identifier |
version | string | Plugin version |
color | string | Color for the rendered shadow |
angle | number | Angle of the rendered shadow |
offset | number | Offset distance of the rendered shadow |
updateDecorationPlugin(params)
Updates a decoration plugin on a text element.
| Property | Type | Required | Description |
|---|---|---|---|
textId | string | Yes | ID of the text element |
decorationPluginId | string | Yes | ID of the decoration plugin |
decorationPlugin | Partial<RichTextDecorationPluginSerializedObject> | Yes | Plugin properties to update |
Decoration Plugin Properties
| Property | Type | Description |
|---|---|---|
name | string | Plugin name/type identifier |
version | string | Plugin version |
fillStyle | string | Fill style/color for the decoration |
TextProperties
All properties are optional. Used both when adding and updating text.
| Property | Type | Description |
|---|---|---|
fontFamily | string | Font family name (e.g. 'Inter', 'Helvetica') |
fontSize | number | Font size in pixels |
fontWeight | string | number | Weight (e.g. 'Regular', 'Bold', 400, 700) |
fill | Color | Text color — CSS color string or gradient object |
textAlign | 'left' | 'center' | 'right' | 'justify' | Horizontal alignment |
lineHeight | number | Line height multiplier (e.g. 1.16) |
charSpacing | number | Letter spacing in thousandths of an em (0 = normal) |
resizeBehavior | 'none' | 'hug' | 'hug-height' | Text box resize mode |
underline | boolean | Underline decoration |
overline | boolean | Overline decoration |
linethrough | boolean | Strikethrough decoration |
angle | number | Rotation in degrees (positive = clockwise) |
scaleX | number | Horizontal scale factor (1 = normal) |
scaleY | number | Vertical scale factor (1 = normal) |
stroke | string | Stroke color (CSS color string) |
strokeWidth | number | Stroke width in pixels |