showNotification
API reference for the "showNotification" method.
Displays a notification.

Usage

1
const canva = window.canva.init();
2
3
canva.onReady(async (opts) => {
4
// Show an "info" notification
5
canva.showNotification("greeting", "info");
6
7
// Show an "error" notification
8
// canva.showNotification("errorMessage", "error");
9
});
Copied!
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
Copy link