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";
(async () => {
await addNativeElement({
type: "TEXT",
children: ["Hello world"],
});
})();

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:

  • Embeds
  • Groups
  • Images
  • Shapes
  • Text
  • Videos

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.

#widthnumber
Sometimes required

The width of the element, in pixels.

#heightnumber
Sometimes required

The height of the element, in pixels.

#topnumber
Sometimes required

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

#leftnumber
Sometimes required

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

#rotationnumber
Optional

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

Promise<void>