Toast
Toasts display brief, temporary notifications of actions, errors, or other events in an application.
Example

Content
Toasts are triggered using the method ui.toast. Toasts use variant to specify the following styles: neutral, positive, negative, and info. Toast will default to neutral if variant is omitted.
Toasts are shown according to the order they are added, with the most recent toast appearing at the bottom of the stack. Please use Toasts sparingly.
Events
Toasts can include an optional action by specifying the action_label and on_action options when queueing a toast. In addition, the on_close event is triggered when the toast is dismissed. The should_close_on_action option automatically closes the toast when an action is performed.
Auto-dismiss
Toasts support a timeout option to automatically hide them after a certain amount of time. For accessibility, toasts have a minimum timeout of 5 seconds, and actionable toasts will not auto dismiss. In addition, timers will pause when the user focuses or hovers over a toast.
Be sure only to automatically dismiss toasts when the information is not important, or may be found elsewhere. Some users may require additional time to read a toast message, and screen zoom users may miss toasts entirely.
Show toast on mount
This example shows how to display a toast when a component mounts.
Toast from table example
This example shows how to create a toast from the latest update of a ticking table. It is recommended to auto dismiss these toasts with a timeout and to avoid ticking faster than the value of the timeout. Note that the toast must be triggered on the render thread, whereas the table listener may be fired from another thread. Therefore you must use the render queue to trigger the toast.
Multi threading example
This example shows how to use toast with multi threading.
API Reference
Toasts display brief, temporary notifications of actions, errors, or other events in an application.
Returns: None None
| Parameters | Type | Default | Description |
|---|---|---|---|
| message | str | The message to display in the toast. | |
| variant | Literal['positive', 'negative', 'neutral', 'info'] | 'neutral' | The variant of the toast. Defaults to "neutral". |
| action_label | str | None | None | The label for the action button with the toast. If provided, an action button will be displayed. |
| should_close_on_action | bool | None | None | Whether the toast should automatically close when an action is performed. |
| timeout | int | None | None | A timeout to automatically close the toast after, in milliseconds. |