create
API reference for the "create" method.
Creates a rich control. An extension must call the updateControlPanel method to render the controls.

Usage

1
const canva = window.canva.init();
2
​
3
canva.onReady(async (opts) => {
4
// Create an array of controls
5
const controls = [
6
canva.create("button", {
7
id: "buttonExample",
8
label: "Button Example",
9
}),
10
];
11
​
12
// Render the controls in the control panel
13
canva.updateControlPanel(controls);
14
});
Copied!

Parameters

Name
Type
Required
Description
controlName
​ControlName​
Yes
The name of the control.
props
object
Yes
The properties for configuring the control. The available properties depend on the control.

Types

ControlName

Represents the name of a control.
Signature
1
enum ControlName {
2
BUTTON = "button",
3
CHECKBOX = "checkbox",
4
COLOR_PICKER = "color_picker",
5
GROUP = "group",
6
PARAGRAPH = "paragraph",
7
RADIO_GROUP = "radio_group",
8
SELECT = "select",
9
SLIDER = "slider",
10
TEXT_INPUT = "text_input",
11
THUMBNAIL_LIST = "thumbnail_list",
12
}
Copied!
Properties
Name
Value
BUTTON
"button"
CHECKBOX
"checkbox"
COLOR_PICKER
"color_picker"
GROUP
"group"
PARAGRAPH
"paragraph"
RADIO_GROUP
"radio_group"
SELECT
"select"
SLIDER
"slider"
TEXT_INPUT
"text_input"
THUMBNAIL_LIST
"thumbnail_list"
Copy link