API reference
Design
addAudioTrackaddElementAtCursoraddElementAtPointaddNativeElementaddPagecreateRichtextRangeeditContentgetCurrentPageContextgetDefaultPageDimensionsgetDesignMetadatagetDesignTokeninitAppElementoverlay.registerOnCanOpenopenDesignrequestExportselection.registerOnChangesetCurrentPageBackgroundui.startDragToCursorui.startDragToPointui.startDrag
Intents: data
Intents: design
Platform
appProcessappProcess.broadcastMessageappProcess.currentappProcess.current.getInfoappProcess.current.requestCloseappProcess.current.setOnDisposeappProcess.requestCloseappProcess.registerOnMessageappProcess.registerOnStateChangefeatures.isSupportedfeatures.registerOnSupportChangegetPlatformInfonotification.addToastrequestOpenExternalUrl
notification.addToast
API reference for the notification.addToast method.
This version of the API is a preview. Preview APIs are unstable and may change without warning. You can't release public apps using this API until it's stable.
A method that shows a toast notification to the user.
Usage
import { notification } from '@canva/platform';import type { ToastRequest } from '@canva/platform';const showToast = () => {const request: ToastRequest = {messageText: "Hello world!",};notification.addToast(request);};<Button onClick={() => showToast()}>Show Toast</Button>
TSX
Parameters
request
ToastRequest
RequiredOptions for configuring a toast notification.
messageText
string
RequiredText to show within the toast notification.
timeoutMs
number | string
OptionalThe duration that the notification will be visible.
If set to "infinite"
, the notification will be displayed until manually dismissed by the user.
If set to a number, the notification will automatically disappear after that duration (in milliseconds).
Default value: 5000
Returns
The result when a toast notification is successfully added. This is a Promise
that resolves with the following object:
status
string
The status of the request.
This must be "completed"
.