create

API reference for the "create" method.

Creates a rich control. An extension must call the updateControlPanel method to render the controls.

Usage

const canva = window.canva.init();
canva.onReady(async (opts) => {
// Create an array of controls
const controls = [
canva.create('button', {
id: 'buttonExample',
label: 'Button Example',
}),
];
// Render the controls in the control panel
canva.updateControlPanel(controls);
});

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

enum ControlName {
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',
}

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"