Skip to main content

sdk.textapi.addtext

Home > @kittl/sdk > TextAPI > addText

TextAPI.addText() method

Creates a new text element within the design artboard with customizable typography and positioning.

This method handles the creation and placement of text objects within the design state, providing comprehensive control over typography, positioning, and styling. It supports both absolute and relative positioning, custom sizing, and extensive font property configuration.

**Note**: Relative positioning for text elements is currently a work in progress and may not function as expected.

Signature:

addText(params: AddTextParams, opts?: DesignApiOptions): NormalizedRichTextObject;

Parameters

Parameter

Type

Description

params

AddTextParams

Configuration parameters for text creation

opts

DesignApiOptions

(Optional) Optional design API configuration options

Returns:

NormalizedRichTextObject

The newly created text object with all computed properties

Exceptions

When the text configuration is invalid or incomplete

When the specified artboard ID doesn't exist