Toast
Last updated
Last updated
When an asynchronous operation is happening or when an error is thrown, it's usually a good idea to keep the user informed about it. Toasts are made for that.
Additionally, Toasts can have some actions associated to the action they are about. For example, you could provide a way to cancel an asynchronous operation, undo an action, or copy the stack trace of an error.
Creates and shows a Toast with the given options.
When showing an animated Toast, you can later on update it:
A Promise that resolves with the shown Toast. The Toast can be used to change or hide it.
A Toast with a certain style, title, and message.
Use showToast to create and show a Toast.
message*
An additional message for the Toast. Useful to show more information, e.g. an identifier of a newly created asset.
string
secondaryAction*
The secondary Action the user can take when hovering on the Toast.
title*
The title of a Toast. Displayed on the top.
string
hide
() => Promise<void>
Hides the Toast.
show
() => Promise<void>
Shows the Toast.
The options to create a Toast.
title*
The title of a Toast. Displayed on the top.
string
message
An additional message for the Toast. Useful to show more information, e.g. an identifier of a newly created asset.
string
secondaryAction
The secondary Action the user can take when hovering on the Toast.
Defines the visual style of the Toast.
Use Toast.Style.Success for confirmations and Toast.Style.Failure for displaying errors. Use Toast.Style.Animated when your Toast should be shown until a process is completed. You can hide it later by using Toast.hide or update the properties of an existing Toast.
Animated
Success
Failure
The options to create a Toast Action.
title*
The title of the action.
string