Toast
Transient notifications stacked in the bottom-right corner.
context.toast(Toast::new("Configurations").content("Saved aim.cfg"));Context::toast(Toast) queues a notification; Context::toast_count() reports how many
are alive. The context keeps and paints it, so it can be queued from any callback, for
example when a button was clicked. Toasts stack in the bottom-right corner of the window
whose Context they were queued on, paint above windows and popups, fade and slide in,
and fade out when their time is up.
| Builder | Effect |
|---|---|
Toast::new(title) / content(text) | Title and optional body |
duration(Duration) | How long it stays before fading |
width(f32) / corner_radius(f32) | Geometry |
fill / border / title_color / content_color | Colors; unset ones come from the current style |
text_sizes(title, content) | Font sizes |
Limitations
Toasts are passive: they never take focus, intercept the pointer, or carry actions or a
close button. They belong to one Context, so with several native windows queue the toast
on the window that should show it.
Accessibility
Role Status, a polite live region: a screen reader speaks the toast once when it
appears, without moving focus. The name is "title: content", or whichever of the two is
present. Toasts stay in the tree above an open modal.
See Accessibility.