showNotification

API reference for the "showNotification" method.

Displays a notification.

Usage

const canva = window.canva.init();
canva.onReady(async (opts) => {
// Show an "info" notification
canva.showNotification('greeting', 'info');
// Show an "error" notification
// canva.showNotification("errorMessage", "error");
});

This example assumes that a localized label exists with a key of "greeting". For more information, refer to Notifications.

Parameters

Name

Type

Required

Description

key

string

Yes

The key of a localized label.

level

"info" | "error"

Yes

The type of notification.

Returns

void