Add element to responsive documents, which slot things into a text stream
Parameters
Elements targeting a cursor are a subset of the base Element
An element that renders image content.
A description of the image content.
The type of element.
This must be "image"
.
A data URL that contains the image data.
A unique identifier that points to an image asset in Canva's backend.
An element that renders video content.
A description of the video content.
A unique identifier that points to a video asset in Canva's backend.
The type of element.
This must be "video"
.
An element that renders text content.
The text content.
Only the first element in this array is used.
The type of element.
This must be "text"
.
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the font.
Default Value: "none"
The available options include:
"none"
"underline"
A unique identifier that points to a font asset in Canva's backend.
The size of the text.
- Minimum: 1
- Maximum: 100
Default Value: 16
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
The alignment of the text.
Default Value: "start"
The available options include:
"start"
"center"
"end"
"justify"
An element that renders richtext content.
The richtext content.
Properties of range
Appends the specified characters to the end of the range.
Parameters
The characters to append to the richtext range.
Options for formatting inline richtext.
Properties of formatting
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the text.
Default Value: "none"
The available options include:
"none"
"underline"
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
The available font weights depend on the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
An external URL that the text links to.
The strikethrough of the text.
Default Value: "none"
The available options include:
"none"
"strikethrough"
Returns
Formats all of the paragraphs that overlap the given bounds.
- The
\n
character indicates the end of a paragraph. - All paragraphs that overlap the provided bounds will be formatted in their entirety.
Parameters
The formatting to apply to the paragraph(s).
Properties of formatting
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the text.
Default Value: "none"
The available options include:
"none"
"underline"
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
The available font weights depend on the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
An external URL that the text links to.
The strikethrough of the text.
Default Value: "none"
The available options include:
"none"
"strikethrough"
A unique identifier that points to a font asset in Canva's backend.
The size of the text, in pixels.
- In the Canva editor, this number is shown as points (pts), not pixels.
- Minimum: 1
- Maximum: 100
The list indentation level of the paragraph.
The appearance of list item markers.
This property only has an effect if listLevel
is greater than 0.
Default Value: "none"
The available options include:
"none"
"disc"
"circle"
"square"
"decimal"
"lower-alpha"
"lower-roman"
"checked"
"unchecked"
The alignment of the text.
Default Value: "start"
The available options include:
"start"
"center"
"end"
"justify"
Returns
void
Formats a region of text with inline formatting properties.
Parameters
The formatting to apply to the text.
Properties of formatting
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the text.
Default Value: "none"
The available options include:
"none"
"underline"
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
The available font weights depend on the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
An external URL that the text links to.
The strikethrough of the text.
Default Value: "none"
The available options include:
"none"
"strikethrough"
Returns
void
Returns the current state of the richtext as plaintext.
Returns
string
Replaces a region of text with the specified characters.
Parameters
The replacement characters.
The formatting to apply to the replaced text.
Properties of formatting
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the text.
Default Value: "none"
The available options include:
"none"
"underline"
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
The available font weights depend on the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
An external URL that the text links to.
The strikethrough of the text.
Default Value: "none"
The available options include:
"none"
"strikethrough"
Returns
The type of element.
This must be "richtext"
.
An element that renders a table.
The rows of the table.
Properties of rows
The cells (columns) of the row.
Each row must have the same number of cells.
This should be either the following object, null
, or undefined
.
The attributes of the cell.
Properties of attributes
The background color of the cell, as a hex code.
The color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
The decoration of the font.
Default Value: "none"
The available options include:
"none"
"underline"
A unique identifier that points to a font asset in Canva's backend.
The size of the text.
- Minimum: 1
- Maximum: 100
Default Value: 16
The style of the font.
Default Value: "normal"
The available options include:
"normal"
"italic"
The weight (thickness) of the font.
Default Value: "normal"
The available options include:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
The alignment of the text.
Default Value: "start"
The available options include:
"start"
"center"
"end"
"justify"
The number of columns that the cell occupies.
The number of rows that the cell occupies.
The available options include:
"empty"
"string"
The plaintext content of the cell.
If an empty string is provided, the type
will change to "empty"
.
The type of element.
This must be "table"
.
Returns
Promise<void>