Toast

Toast briefly acknowledges an event without interrupting the current task. Use it for messages like “Message sent” or “Copied” when the surrounding screen already provides the context.

Example

use fission::prelude::*;

fission_component! {
    pub ReplySentNotice<()> {
        props { dismiss: ActionEnvelope }
    }

    view(notice, _state, cx) =>
        Toast(
            id: WidgetId::explicit("reply.sent"),
            kind: ToastKind::Success,
            message: cx.tr("reply.sent"),
            on_close: notice.dismiss.clone(),
            duration: ToastDuration::Default,
        )
}

Field table

Field
Type
Meaning
Notes / default behavior
id
WidgetId
Stable toast identity.
Retains motion and the independent dismissal timer; use a distinct id per concurrent notification.
kind
ToastKind
Severity and visual tone of the message.
Required. Controls icon and accent treatment.
message
String
Main toast text.
Required. Keep it short.
on_close
Option<ActionEnvelope>
Action fired by close and elapsed duration.
The parent removes the toast; the widget does not mutate the list.
duration
ToastDuration
Automatic close-request timing.
Default is 5 seconds, Millis(ms) overrides it, Persistent disables the timer.
motion
Option<ToastMotion>
Entry/exit motion.
None follows standard widget motion.

Lifecycle guidance

A toast with on_close requests dismissal after its duration and from the close button. The parent must actually remove the toast in that reducer; the visual widget does not own the collection. Use Persistent for information a person must act on, and guard against a stale timer dismissing a newer notification that reused an id. Position the surface in the application's toast overlay: Toast itself is not an automatic global portal.
Also remember that a toast is not a good place for dense recovery instructions. If the user needs to read, compare, or act carefully, an inline alert or dialog is usually the better fit.

Production checklist

•
Create the success notice only after the operation really succeeds.
•
Test timer dismissal, explicit close, persistent duration, and stale notification ids.
•
Keep important recovery information inline rather than relying on a timed surface.
Previous
Tabs