CanvaApiClient

Provides methods for interacting with Canva.

Usage

// Initialize the client (this returns a CanvaApiClient object)
const canva = window.canva.init();
​
// The CanvaApiClient object provides methods for interacting with Canva
canva.onReady(async () => {
console.log('The client is initialized!');
});

Methods

Name

Description

​create​

Creates a control that can be rendered in the control panel.

​exit​

Exits the user from the extension.

​onControlsEvent​

Registers a callback that runs when the user interacts with a control.

​onImageUpdate​

Registers a callback that runs when Canva requests the extension to update the user's image.

​onLayoutChange​

Registers a callback that runs when the layout of the iframe changes.

​onPresetSelected​

Registers a callback that runs when the user selects a preset.

​onPresetsRequest​

Registers a callback that runs when Canva requests presets from an extension.

​onReady​

Registers a callback that runs when the extension has finished loading.

​onSaveRequest​

Registers a callback that runs when Canva emits a save request.

​onTouchModeExit​

Registers a callback that runs when a user exits touch mode.

​onViewportResize​

Registers a callback that runs when the size of the viewport changes.

​remoteProcess​

Sends the user's image to a server for remote image processing.

​reportError​

Reports an error to Canva.

​showNotification​

Displays a notification.

​toggleSpinner​

Shows or hides a loading spinner.

​toggleTouchMode​

Enables or disables touch mode.

​updateControlPanel​

Renders controls in the side panel.

​updateLayout​

Updates the layout of the iframe that contains the user's image.

Contents
Usage
Methods