Adds a native element to a user's design.
To learn more, see:
- Creating images
- Creating shapes
- Creating text
- Creating videos
- Embedding rich media
- Grouping elements
Usage
import { addNativeElement } from "@canva/design";(async () => {await addNativeElement({type: "TEXT",children: ["Hello world"],});})();
Rate limit
This method has a rate limit of 20 requests every 10 seconds.
Parameters
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:
Required
The type of element. For embed elements, this must be "EMBED"
.
Required
The URL of the embeddable media.
Sometimes required
The width of the element, in pixels.
Sometimes required
The height of the element, in pixels.
Sometimes required
The distance from the top edge of the container, in pixels.
Sometimes required
The distance from the left edge of the container, in pixels.
Optional
The rotation of the element, in degrees. This must be a number between -180
and 180
.
Returns
Promise<void>