Adds a native element to a user's design.
Usage
import { getDesignInteraction } from "@canva/design-interaction";const designInteraction = getDesignInteraction();designInteraction.addNativeElement({type: "TEXT",children: ["Hello world"],});
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 the element to add to the design. For an embed element, this must be "EMBED"
.
Required
The URL of the embed. This URL must be supported by the Iframely API. To learn more, see What URLs to send to Iframely.
Required
The width of the element, in pixels.
Required
The height of the element, in pixels.
Required
The distance from the top edge of the user's design, in pixels.
Required
The distance from the left edge of the user's design, in pixels.
Optional
The rotation of the element, in degrees. This must be an integer between -180 and 180.
Returns
void