openDesign
Reads a specified part of the user's design and returns all elements in that part.
Parameters
options
DesignContextOptions
RequiredOptions for configuring which part of a design to read.
type
string
RequiredThe type of context.
This must be "current_page"
.
callback
function
RequiredParameters
draft
CurrentPageResult
RequiredThe result of reading part of a design when the context is the current page.
save
function
Required- Any changes to the draft are only reflected in the design after this method is called.
- Once this method is called, further changes to the draft are not possible.
Returns
Promise<void>
page
FixedPage
RequiredThe current page of the design.
type
string
RequiredThe type of page.
This must be "fixed"
.
locked
boolean
RequiredIf true
, the page is locked and cannot be modified.
dimensions
undefined | Dimensions
RequiredThe dimensions of the page. dimensions
is undefined for whiteboard pages.
width
number
RequiredA width, in pixels.
height
number
RequiredA height, in pixels.
background
undefined | Fill
RequiredThe background of the page. background
is undefined for whiteboard pages.
media
undefined | MediaFill
RequiredThe media fill for the path, if any.
An image that fills the interior of a path.
type
string
RequiredThe type of media.
This must be "image"
.
imageRef
ImageRef
RequiredA unique identifier that points to an image asset in Canva's backend.
flipX
boolean
RequiredIf true
, the image is flipped horizontally.
flipY
boolean
RequiredIf true
, the image is flipped vertically.
A video that fills the interior of a path.
type
string
RequiredThe type of media.
This must be "video"
.
videoRef
VideoRef
RequiredA unique identifier that points to a video asset in Canva's backend.
flipX
boolean
RequiredIf true
, the video is flipped horizontally.
flipY
boolean
RequiredIf true
, the video is flipped vertically.
color
undefined | ColorFill
RequiredThe color fill for the path, if any.
A solid color that fills the interior of a path.
type
string
RequiredThe type of color.
This must be "solid"
.
color
string
RequiredThe color of the fill, as a hex code.
- Must be six characters long.
- Must start with a
#
. - Must use lowercase letters.
Represents an element that's not supported by the Apps SDK.
type
string
RequiredThe type of element.
This must be "unsupported"
.
elements
List<FixedElement>
RequiredThe elements on the page.
Elements are rendered in the order they appear in the list. Later elements appear on top of earlier ones.
count
function
RequiredReturns
The number of items.
number
toArray
function
RequiredReturns
An array containing all items. The items are the same as in the list.
readonly T
[]
forEach
function
RequiredParameters
callback
ForEachCallback<T>
RequiredThe function to run for each item.
Parameters
item
T
RequiredThe current item in the list.
index
number
RequiredThe index of the current item.
Returns
void
Returns
void
filter
function
RequiredParameters
filter
FilterPredicate<T>
RequiredA function that tests each item. Returns true
to keep the item.
Parameters
item
T
RequiredThe item to test.
Returns
true
if the item should be included, otherwise false
.
boolean
Returns
An array of items that passed the test.
readonly T
[]
insertBefore
function
RequiredParameters
ref
undefined | T
RequiredThe existing item to place the new item before.
If ref
is undefined
, the new item is added at the end of the list.
If ref
does not exist in the list, the operation fails.
item
T
RequiredThe item to add. A copy of this item will be inserted.
Returns
The added item, or undefined
if the operation failed.
undefined | T
insertAfter
function
RequiredParameters
ref
undefined | T
RequiredThe existing item to place the new item after.
If ref
is undefined
, the new item is added at the end of the list.
If ref
does not exist in the list, the operation fails.
item
T
RequiredThe item to add. A copy of this item will be inserted.
Returns
The added item, or undefined
if the operation failed.
undefined | T
moveBefore
function
RequiredParameters
ref
undefined | T
RequiredThe existing item to move the item before.
If ref
is undefined
, the item is moved to the end of the list.
If ref
does not exist in the list, the operation fails.
item
T
RequiredThe item to move. The operation fails if the item is not already in the list.
Returns
void
moveAfter
function
RequiredParameters
ref
undefined | T
RequiredThe existing item to move the item after.
If ref
is undefined
, the item is moved to the end of the list.
If ref
does not exist in the list, the operation fails.
item
T
RequiredThe item to move. The operation fails if the item is not already in the list.
Returns
void
delete
function
RequiredParameters
item
T
RequiredThe item to remove from the list.
Returns
void
helpers
object
RequiredelementBuilder
ElementBuilder
RequiredProvides methods for creating elements.
These methods don't add the elements to the design. They only return elements that can
be added to a design, such as with the insertAfter
method.
createRectElement
function
RequiredParameters
opts
CreateRectElementOpts
RequiredOptions for creating the rect element.
fill
FillOpts
Optionalcolor
ColorFillOpts
media
MediaFillOpts
Options for creating an image fill in the element builder
Options for creating a video fill in the element builder
stroke
StrokeOpts
Optionalcolor
ColorFillOpts
Requiredweight
number
RequiredThe weight (thickness) of the stroke.
Minimum: 0
Maximum: 100
Returns
An element that renders a rectangle.
The rectangle can be filled with image content, video content, or a solid color.
width
number
A width, in pixels.
height
number
A height, in pixels.
locked
boolean
If true
, the element is locked and cannot be modified.
top
number
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
A rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
Transparency as a percentage.
Minimum: 0
Maximum: 1
type
string
The type of content.
This must be "rect"
.
fill
Fill
The appearance of the rectangle's interior.
media
undefined | MediaFill
The media fill for the path, if any.
An image that fills the interior of a path.
type
string
The type of media.
This must be "image"
.
imageRef
ImageRef
A unique identifier that points to an image asset in Canva's backend.
flipX
boolean
If true
, the image is flipped horizontally.
flipY
boolean
If true
, the image is flipped vertically.
A video that fills the interior of a path.
type
string
The type of media.
This must be "video"
.
videoRef
VideoRef
A unique identifier that points to a video asset in Canva's backend.
flipX
boolean
If true
, the video is flipped horizontally.
flipY
boolean
If true
, the video is flipped vertically.
color
undefined | ColorFill
The color fill for the path, if any.
A solid color that fills the interior of a path.
type
string
The type of color.
This must be "solid"
.
color
string
The color of the fill, as a hex code.
- Must be six characters long.
- Must start with a
#
. - Must use lowercase letters.
Represents an element that's not supported by the Apps SDK.
type
string
The type of element.
This must be "unsupported"
.
stroke
Stroke
The outline of the rectangle.
weight
number
The weight (thickness) of the stroke.
Minimum: 0
Maximum: 100
color
ColorFill
The color of the stroke.
A solid color that fills the interior of a path.
type
string
The type of color.
This must be "solid"
.
color
string
The color of the fill, as a hex code.
- Must be six characters long.
- Must start with a
#
. - Must use lowercase letters.
Represents an element that's not supported by the Apps SDK.
type
string
The type of element.
This must be "unsupported"
.
createShapeElement
function
RequiredParameters
opts
CreateShapeElementOpts
RequiredOptions for creating the shape element.
paths
PathOpts[]
Requiredfill
FillOpts
Optionalcolor
ColorFillOpts
media
MediaFillOpts
Options for creating an image fill in the element builder
Options for creating a video fill in the element builder
stroke
StrokeOpts
Optionalcolor
ColorFillOpts
Requiredweight
number
RequiredThe weight (thickness) of the stroke.
Minimum: 0
Maximum: 100
d
string
RequiredThe shape of the path.
This is similar to the d
attribute of an SVG's path
element, with some limitations:
- Must start with an
M
command. - Only one
M
command is allowed. Q
andT
commands are not permitted.- The path must be closed using a
Z
command or matching start and end coordinates.
Returns
An element that renders a vector shape.
width
number
A width, in pixels.
height
number
A height, in pixels.
locked
boolean
If true
, the element is locked and cannot be modified.
top
number
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
A rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
Transparency as a percentage.
Minimum: 0
Maximum: 1
type
string
The type of content.
This must be "shape"
.
viewBox
AlignedBox
The scale and cropping of the shape.
top
number
The distance of the shape from the top edge of the element, in pixels.
left
number
The distance of the shape from the left edge of the element, in pixels.
width
number
The width of the view box, in pixels.
height
number
The height of the view box, in pixels.
paths
ReadableList<Path>
The paths that define the structure of the shape.
- Must have between 1 and 30 paths.
- Total size of all paths must not exceed 2kb.
- Maximum of 6 unique fill colors across all paths.
count
function
Returns
The number of items.
number
toArray
function
Returns
An array containing all items. The items are the same as in the list.
readonly T
[]
forEach
function
Parameters
callback
ForEachCallback<T>
RequiredThe function to run for each item.
Parameters
item
T
RequiredThe current item in the list.
index
number
RequiredThe index of the current item.
Returns
void
Returns
void
filter
function
Parameters
filter
FilterPredicate<T>
RequiredA function that tests each item. Returns true
to keep the item.
Parameters
item
T
RequiredThe item to test.
Returns
true
if the item should be included, otherwise false
.
boolean
Returns
An array of items that passed the test.
readonly T
[]
createEmbedElement
function
RequiredParameters
opts
CreateEmbedElementOpts
RequiredOptions for creating the embed element.
Returns
An element that embeds rich media, such as a YouTube video.
width
number
A width, in pixels.
height
number
A height, in pixels.
locked
boolean
If true
, the element is locked and cannot be modified.
top
number
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
A rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
Transparency as a percentage.
Minimum: 0
Maximum: 1
type
string
The type of content.
This must be "embed"
.
url
string
The URL of the rich media.
This URL must be supported by the Iframely API.
createTextElement
function
RequiredParameters
opts
CreateTextElementOpts
RequiredOptions for creating the text element.
Returns
An element that renders text content.
width
number
A width, in pixels.
height
number
A height, in pixels.
locked
boolean
If true
, the element is locked and cannot be modified.
top
number
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
A rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
Transparency as a percentage.
Minimum: 0
Maximum: 1
type
string
The type of content.
This must be "text"
.
text
RichtextRange
The text content.
formatParagraph
function
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
bounds
Bounds
RequiredThe segment of the range on which to apply the formatting.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
formatting
RichtextFormatting
RequiredThe formatting to apply to the paragraph(s).
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
fontRef
FontRef
OptionalA unique identifier that points to a font asset in Canva's backend.
fontSize
number
OptionalThe size of the text, in pixels.
- In the Canva editor, this number is shown as points (pts), not pixels.
Minimum: 1
Maximum: 100
textAlign
string
OptionalThe alignment of the text.
Default value: "start"
Available values:
"start"
"center"
"end"
"justify"
listLevel
number
OptionalThe list indentation level of the paragraph.
listMarker
string
OptionalThe appearance of list item markers.
This property only has an effect if listLevel
is greater than 0.
Default value: "none"
Available values:
"none"
"disc"
"circle"
"square"
"decimal"
"lower-alpha"
"lower-roman"
"checked"
"unchecked"
Returns
void
formatText
function
Formats a region of text with inline formatting properties.
Parameters
bounds
Bounds
RequiredThe segment of the range on which to apply the formatting.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
formatting
InlineFormatting
RequiredThe formatting to apply to the text.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
void
appendText
function
Appends the specified characters to the end of the range.
Parameters
characters
string
RequiredThe characters to append to the richtext range.
formatting
InlineFormatting
OptionalOptions for formatting inline richtext.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
bounds
Bounds
A segment of a richtext range.
index
number
The starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
The number of characters in the segment, starting from the index.
replaceText
function
Replaces a region of text with the specified characters.
Parameters
bounds
Bounds
RequiredThe segment of the range to replace.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
characters
string
RequiredThe replacement characters.
formatting
InlineFormatting
OptionalThe formatting to apply to the replaced text.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
bounds
Bounds
The bounds of the replacement characters within the updated range.
index
number
The starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
The number of characters in the segment, starting from the index.
readPlaintext
function
Returns the current state of the richtext as plaintext.
Returns
string
readTextRegions
function
Returns the current state of the richtext as one or more text regions. Each region is an object that contains the text content and its formatting.
Returns
text
string
The plaintext content of the region.
formatting
Partial<RichtextFormatting>
OptionalThe formatting of the region.
createRichtextRange
function
RequiredReturns
Provides methods for interacting with a range of formatted text.
formatParagraph
function
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
bounds
Bounds
RequiredThe segment of the range on which to apply the formatting.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
formatting
RichtextFormatting
RequiredThe formatting to apply to the paragraph(s).
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
fontRef
FontRef
OptionalA unique identifier that points to a font asset in Canva's backend.
fontSize
number
OptionalThe size of the text, in pixels.
- In the Canva editor, this number is shown as points (pts), not pixels.
Minimum: 1
Maximum: 100
textAlign
string
OptionalThe alignment of the text.
Default value: "start"
Available values:
"start"
"center"
"end"
"justify"
listLevel
number
OptionalThe list indentation level of the paragraph.
listMarker
string
OptionalThe appearance of list item markers.
This property only has an effect if listLevel
is greater than 0.
Default value: "none"
Available values:
"none"
"disc"
"circle"
"square"
"decimal"
"lower-alpha"
"lower-roman"
"checked"
"unchecked"
Returns
void
formatText
function
Formats a region of text with inline formatting properties.
Parameters
bounds
Bounds
RequiredThe segment of the range on which to apply the formatting.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
formatting
InlineFormatting
RequiredThe formatting to apply to the text.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
void
appendText
function
Appends the specified characters to the end of the range.
Parameters
characters
string
RequiredThe characters to append to the richtext range.
formatting
InlineFormatting
OptionalOptions for formatting inline richtext.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
bounds
Bounds
A segment of a richtext range.
index
number
The starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
The number of characters in the segment, starting from the index.
replaceText
function
Replaces a region of text with the specified characters.
Parameters
bounds
Bounds
RequiredThe segment of the range to replace.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
characters
string
RequiredThe replacement characters.
formatting
InlineFormatting
OptionalThe formatting to apply to the replaced text.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
bounds
Bounds
The bounds of the replacement characters within the updated range.
index
number
The starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
The number of characters in the segment, starting from the index.
readPlaintext
function
Returns the current state of the richtext as plaintext.
Returns
string
readTextRegions
function
Returns the current state of the richtext as one or more text regions. Each region is an object that contains the text content and its formatting.
Returns
text
string
The plaintext content of the region.
formatting
Partial<RichtextFormatting>
OptionalThe formatting of the region.
cloneElement
function
RequiredParameters
element
object
RequiredAn element that renders a rectangle.
The rectangle can be filled with image content, video content, or a solid color.
width
number
RequiredA width, in pixels.
height
number
RequiredA height, in pixels.
locked
boolean
RequiredIf true
, the element is locked and cannot be modified.
top
number
RequiredThe distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
RequiredThe distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
RequiredA rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
RequiredTransparency as a percentage.
Minimum: 0
Maximum: 1
type
string
RequiredThe type of content.
This must be "rect"
.
fill
Fill
RequiredThe appearance of the rectangle's interior.
media
undefined | MediaFill
RequiredThe media fill for the path, if any.
An image that fills the interior of a path.
type
string
RequiredThe type of media.
This must be "image"
.
imageRef
ImageRef
RequiredA unique identifier that points to an image asset in Canva's backend.
flipX
boolean
RequiredIf true
, the image is flipped horizontally.
flipY
boolean
RequiredIf true
, the image is flipped vertically.
A video that fills the interior of a path.
type
string
RequiredThe type of media.
This must be "video"
.
videoRef
VideoRef
RequiredA unique identifier that points to a video asset in Canva's backend.
flipX
boolean
RequiredIf true
, the video is flipped horizontally.
flipY
boolean
RequiredIf true
, the video is flipped vertically.
color
undefined | ColorFill
RequiredThe color fill for the path, if any.
A solid color that fills the interior of a path.
type
string
RequiredThe type of color.
This must be "solid"
.
color
string
RequiredThe color of the fill, as a hex code.
- Must be six characters long.
- Must start with a
#
. - Must use lowercase letters.
Represents an element that's not supported by the Apps SDK.
type
string
RequiredThe type of element.
This must be "unsupported"
.
stroke
Stroke
RequiredThe outline of the rectangle.
weight
number
RequiredThe weight (thickness) of the stroke.
Minimum: 0
Maximum: 100
color
ColorFill
RequiredThe color of the stroke.
A solid color that fills the interior of a path.
type
string
RequiredThe type of color.
This must be "solid"
.
color
string
RequiredThe color of the fill, as a hex code.
- Must be six characters long.
- Must start with a
#
. - Must use lowercase letters.
Represents an element that's not supported by the Apps SDK.
type
string
RequiredThe type of element.
This must be "unsupported"
.
An element that renders a vector shape.
width
number
RequiredA width, in pixels.
height
number
RequiredA height, in pixels.
locked
boolean
RequiredIf true
, the element is locked and cannot be modified.
top
number
RequiredThe distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
RequiredThe distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
RequiredA rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
RequiredTransparency as a percentage.
Minimum: 0
Maximum: 1
type
string
RequiredThe type of content.
This must be "shape"
.
viewBox
AlignedBox
RequiredThe scale and cropping of the shape.
top
number
RequiredThe distance of the shape from the top edge of the element, in pixels.
left
number
RequiredThe distance of the shape from the left edge of the element, in pixels.
width
number
RequiredThe width of the view box, in pixels.
height
number
RequiredThe height of the view box, in pixels.
paths
ReadableList<Path>
RequiredThe paths that define the structure of the shape.
- Must have between 1 and 30 paths.
- Total size of all paths must not exceed 2kb.
- Maximum of 6 unique fill colors across all paths.
count
function
RequiredReturns
The number of items.
number
toArray
function
RequiredReturns
An array containing all items. The items are the same as in the list.
readonly T
[]
forEach
function
RequiredParameters
callback
ForEachCallback<T>
RequiredThe function to run for each item.
Parameters
item
T
RequiredThe current item in the list.
index
number
RequiredThe index of the current item.
Returns
void
Returns
void
filter
function
RequiredParameters
filter
FilterPredicate<T>
RequiredA function that tests each item. Returns true
to keep the item.
Parameters
item
T
RequiredThe item to test.
Returns
true
if the item should be included, otherwise false
.
boolean
Returns
An array of items that passed the test.
readonly T
[]
An element that embeds rich media, such as a YouTube video.
width
number
RequiredA width, in pixels.
height
number
RequiredA height, in pixels.
locked
boolean
RequiredIf true
, the element is locked and cannot be modified.
top
number
RequiredThe distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
RequiredThe distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
RequiredA rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
RequiredTransparency as a percentage.
Minimum: 0
Maximum: 1
type
string
RequiredThe type of content.
This must be "embed"
.
url
string
RequiredThe URL of the rich media.
This URL must be supported by the Iframely API.
An element that renders text content.
width
number
RequiredA width, in pixels.
height
number
RequiredA height, in pixels.
locked
boolean
RequiredIf true
, the element is locked and cannot be modified.
top
number
RequiredThe distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
RequiredThe distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
RequiredA rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
RequiredTransparency as a percentage.
Minimum: 0
Maximum: 1
type
string
RequiredThe type of content.
This must be "text"
.
text
RichtextRange
RequiredThe text content.
formatParagraph
function
RequiredFormats 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
bounds
Bounds
RequiredThe segment of the range on which to apply the formatting.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
formatting
RichtextFormatting
RequiredThe formatting to apply to the paragraph(s).
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
fontRef
FontRef
OptionalA unique identifier that points to a font asset in Canva's backend.
fontSize
number
OptionalThe size of the text, in pixels.
- In the Canva editor, this number is shown as points (pts), not pixels.
Minimum: 1
Maximum: 100
textAlign
string
OptionalThe alignment of the text.
Default value: "start"
Available values:
"start"
"center"
"end"
"justify"
listLevel
number
OptionalThe list indentation level of the paragraph.
listMarker
string
OptionalThe appearance of list item markers.
This property only has an effect if listLevel
is greater than 0.
Default value: "none"
Available values:
"none"
"disc"
"circle"
"square"
"decimal"
"lower-alpha"
"lower-roman"
"checked"
"unchecked"
Returns
void
formatText
function
RequiredFormats a region of text with inline formatting properties.
Parameters
bounds
Bounds
RequiredThe segment of the range on which to apply the formatting.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
formatting
InlineFormatting
RequiredThe formatting to apply to the text.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
void
appendText
function
RequiredAppends the specified characters to the end of the range.
Parameters
characters
string
RequiredThe characters to append to the richtext range.
formatting
InlineFormatting
OptionalOptions for formatting inline richtext.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
bounds
Bounds
A segment of a richtext range.
index
number
The starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
The number of characters in the segment, starting from the index.
replaceText
function
RequiredReplaces a region of text with the specified characters.
Parameters
bounds
Bounds
RequiredThe segment of the range to replace.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
characters
string
RequiredThe replacement characters.
formatting
InlineFormatting
OptionalThe formatting to apply to the replaced text.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
bounds
Bounds
The bounds of the replacement characters within the updated range.
index
number
The starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
The number of characters in the segment, starting from the index.
readPlaintext
function
RequiredReturns the current state of the richtext as plaintext.
Returns
string
readTextRegions
function
RequiredReturns the current state of the richtext as one or more text regions. Each region is an object that contains the text content and its formatting.
Returns
text
string
The plaintext content of the region.
formatting
Partial<RichtextFormatting>
OptionalThe formatting of the region.
Returns
An element that renders a rectangle.
The rectangle can be filled with image content, video content, or a solid color.
width
number
A width, in pixels.
height
number
A height, in pixels.
locked
boolean
If true
, the element is locked and cannot be modified.
top
number
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
A rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
Transparency as a percentage.
Minimum: 0
Maximum: 1
type
string
The type of content.
This must be "rect"
.
fill
Fill
The appearance of the rectangle's interior.
media
undefined | MediaFill
The media fill for the path, if any.
An image that fills the interior of a path.
type
string
The type of media.
This must be "image"
.
imageRef
ImageRef
A unique identifier that points to an image asset in Canva's backend.
flipX
boolean
If true
, the image is flipped horizontally.
flipY
boolean
If true
, the image is flipped vertically.
A video that fills the interior of a path.
type
string
The type of media.
This must be "video"
.
videoRef
VideoRef
A unique identifier that points to a video asset in Canva's backend.
flipX
boolean
If true
, the video is flipped horizontally.
flipY
boolean
If true
, the video is flipped vertically.
color
undefined | ColorFill
The color fill for the path, if any.
A solid color that fills the interior of a path.
type
string
The type of color.
This must be "solid"
.
color
string
The color of the fill, as a hex code.
- Must be six characters long.
- Must start with a
#
. - Must use lowercase letters.
Represents an element that's not supported by the Apps SDK.
type
string
The type of element.
This must be "unsupported"
.
stroke
Stroke
The outline of the rectangle.
weight
number
The weight (thickness) of the stroke.
Minimum: 0
Maximum: 100
color
ColorFill
The color of the stroke.
A solid color that fills the interior of a path.
type
string
The type of color.
This must be "solid"
.
color
string
The color of the fill, as a hex code.
- Must be six characters long.
- Must start with a
#
. - Must use lowercase letters.
Represents an element that's not supported by the Apps SDK.
type
string
The type of element.
This must be "unsupported"
.
An element that renders a vector shape.
width
number
A width, in pixels.
height
number
A height, in pixels.
locked
boolean
If true
, the element is locked and cannot be modified.
top
number
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
A rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
Transparency as a percentage.
Minimum: 0
Maximum: 1
type
string
The type of content.
This must be "shape"
.
viewBox
AlignedBox
The scale and cropping of the shape.
top
number
The distance of the shape from the top edge of the element, in pixels.
left
number
The distance of the shape from the left edge of the element, in pixels.
width
number
The width of the view box, in pixels.
height
number
The height of the view box, in pixels.
paths
ReadableList<Path>
The paths that define the structure of the shape.
- Must have between 1 and 30 paths.
- Total size of all paths must not exceed 2kb.
- Maximum of 6 unique fill colors across all paths.
count
function
Returns
The number of items.
number
toArray
function
Returns
An array containing all items. The items are the same as in the list.
readonly T
[]
forEach
function
Parameters
callback
ForEachCallback<T>
RequiredThe function to run for each item.
Parameters
item
T
RequiredThe current item in the list.
index
number
RequiredThe index of the current item.
Returns
void
Returns
void
filter
function
Parameters
filter
FilterPredicate<T>
RequiredA function that tests each item. Returns true
to keep the item.
Parameters
item
T
RequiredThe item to test.
Returns
true
if the item should be included, otherwise false
.
boolean
Returns
An array of items that passed the test.
readonly T
[]
An element that embeds rich media, such as a YouTube video.
width
number
A width, in pixels.
height
number
A height, in pixels.
locked
boolean
If true
, the element is locked and cannot be modified.
top
number
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
A rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
Transparency as a percentage.
Minimum: 0
Maximum: 1
type
string
The type of content.
This must be "embed"
.
url
string
The URL of the rich media.
This URL must be supported by the Iframely API.
An element that renders text content.
width
number
A width, in pixels.
height
number
A height, in pixels.
locked
boolean
If true
, the element is locked and cannot be modified.
top
number
The distance from the top edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
left
number
The distance from the left edge of the container, in pixels.
- The pixels are relative to their container.
Minimum: -32768
Maximum: 32767
rotation
number
A rotation, in degrees.
Minimum: -180
Maximum: 180
transparency
number
Transparency as a percentage.
Minimum: 0
Maximum: 1
type
string
The type of content.
This must be "text"
.
text
RichtextRange
The text content.
formatParagraph
function
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
bounds
Bounds
RequiredThe segment of the range on which to apply the formatting.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
formatting
RichtextFormatting
RequiredThe formatting to apply to the paragraph(s).
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
fontRef
FontRef
OptionalA unique identifier that points to a font asset in Canva's backend.
fontSize
number
OptionalThe size of the text, in pixels.
- In the Canva editor, this number is shown as points (pts), not pixels.
Minimum: 1
Maximum: 100
textAlign
string
OptionalThe alignment of the text.
Default value: "start"
Available values:
"start"
"center"
"end"
"justify"
listLevel
number
OptionalThe list indentation level of the paragraph.
listMarker
string
OptionalThe appearance of list item markers.
This property only has an effect if listLevel
is greater than 0.
Default value: "none"
Available values:
"none"
"disc"
"circle"
"square"
"decimal"
"lower-alpha"
"lower-roman"
"checked"
"unchecked"
Returns
void
formatText
function
Formats a region of text with inline formatting properties.
Parameters
bounds
Bounds
RequiredThe segment of the range on which to apply the formatting.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
formatting
InlineFormatting
RequiredThe formatting to apply to the text.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
void
appendText
function
Appends the specified characters to the end of the range.
Parameters
characters
string
RequiredThe characters to append to the richtext range.
formatting
InlineFormatting
OptionalOptions for formatting inline richtext.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
bounds
Bounds
A segment of a richtext range.
index
number
The starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
The number of characters in the segment, starting from the index.
replaceText
function
Replaces a region of text with the specified characters.
Parameters
bounds
Bounds
RequiredThe segment of the range to replace.
index
number
RequiredThe starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
RequiredThe number of characters in the segment, starting from the index.
characters
string
RequiredThe replacement characters.
formatting
InlineFormatting
OptionalThe formatting to apply to the replaced text.
color
string
OptionalThe color of the text as a hex code.
The hex code must include all six characters and be prefixed with a #
symbol.
Example
"#ff0099"
fontWeight
FontWeight
OptionalThe weight (thickness) of the font.
The available font weights depend on the font.
Default value: "normal"
Available values:
"normal"
"thin"
"extralight"
"light"
"medium"
"semibold"
"bold"
"ultrabold"
"heavy"
fontStyle
string
OptionalThe style of the font.
Default value: "normal"
Available values:
"normal"
"italic"
decoration
string
OptionalThe decoration of the text.
Default value: "none"
Available values:
"none"
"underline"
strikethrough
string
OptionalThe strikethrough of the text.
Default value: "none"
Available values:
"none"
"strikethrough"
link
string
OptionalAn external URL that the text links to.
Returns
bounds
Bounds
The bounds of the replacement characters within the updated range.
index
number
The starting position of the segment.
This is zero-based, meaning the first character of the range is at index 0.
length
number
The number of characters in the segment, starting from the index.
readPlaintext
function
Returns the current state of the richtext as plaintext.
Returns
string
readTextRegions
function
Returns the current state of the richtext as one or more text regions. Each region is an object that contains the text content and its formatting.
Returns
text
string
The plaintext content of the region.
formatting
Partial<RichtextFormatting>
OptionalThe formatting of the region.
Returns
void
or Promise<void>
Returns
Promise<void>