notify
Shows a notification on the bottom of the screen.
Signature
notify(message: string, options?: NotificationOptions): NotificationHandler
Parameters
message
The message to show. It is limited to 100 characters. Longer messages will be truncated.
options
An optional argument with the following optional parameters:
interface NotificationOptions {
timeout?: number;
error?: boolean;
}
timeout
: How long the notification stays up in milliseconds before closing. Defaults to 4 seconds when not specified. Set the timeout toInfinity
to make the notification show indefinitely until the plugin is closed.error
: If true, display the notification as an error message, with a different color.
Remarks
The notify
API is a convenient way to show a message to the user. These messages can be queued.
Calling figma.notify
returns a NotificationHandler
object. This object contains a single handler.cancel()
method that can be used to remove the notification before it times out by itself. This is useful if the notification becomes no longer relevant.
interface NotificationHandler {
cancel: () => void
}
An alternative way to show a message to the user is to pass a message to the figma.closePlugin
function.