addNativeElement

API reference for the addNativeElement method.

Adds a native element to a user's design.

To learn more, see:

import { addNativeElement } from "@canva/design";
await addNativeElement({
type: "TEXT",
children: ["Hello world"],
});
ts

Before an app that uses this method can be submitted for review, the canva:design:content:write permission must be enabled via the Developer Portal. To learn more, see Configuring permissions.

This method has a rate limit of 20 requests every 10 seconds.

The expected parameters depend on the type of element being added to the design:

To add an embed element to the user's design, set the following parameters:

#typestring
Required

The type of element. For embed elements, this must be "EMBED".

#urlstring
Required

The URL of the embeddable media.

This URL must be supported by Iframely. To learn more, see What URLs to send to Iframely.

#widthnumber
Sometimes required

The width of the element, in pixels.

If height is a number, this can be set to "auto".

#heightnumber
Sometimes required

The height of the element, in pixels.

If width is a number, this can be set to "auto".

#topnumber
Sometimes required

The distance from the top edge of the container, in pixels.

The container could be a page, a group, or an app element.

#leftnumber
Sometimes required

The distance from the left edge of the container, in pixels.

The container could be a page, a group, or an app element.

#rotationnumber
Optional

The rotation of the element, in degrees. This must be a number between -180 and 180.

Promise<void>