Expand description
Toast notification — stackable, action-rich, severity-aware floating
notification (the “upgrade path” from Snackbar).
Distinct from siblings:
Snackbar— single-instance, message-only. Callingpresent_snackbardismisses all other overlays first.Banner— persistent inline strip, not a floating overlay.MessageBox— modal dialog. Blocks interaction with the rest of the UI.
A Toast is built with one of the four severity constructors
(info / success / warning / error) plus a loading variant,
configured via builder methods, and presented with
ctx.show_toast(toast) (see
toast::ext::EventContextToastExt)
or toast.present(ctx). A ToastHost
installed via TeksiloAppBuilder.install_toast(opts) from the teksilo
umbrella accepts the request, picks a free slot from its pool, and
mounts a ToastSurface at the
configured viewport corner using the
OverlayPlacement::ViewportCorner
variant.
ⓘ
ctx.show_toast(
Toast::warning(tr!(unsaved_changes()))
.body(tr!(close_anyway_question()))
.action(ToastAction::primary(tr!(save()), |c| c.send_intent(AppIntent::Save)))
.action(ToastAction::new(tr!(discard()), |c| c.send_intent(AppIntent::Discard)))
);Re-exports§
pub use body::TOAST_BODY_COLLAPSED_LINES;pub use ext::EventContextToastExt;pub use host::ToastHost;pub use host::ToastInstallOptions;pub use registry::ToastRegistry;pub use surface::ToastSurface;
Modules§
- body
CollapsibleBody— a toast body that clamps to a few lines and offers to unfold.- ext
- Extension methods on [
EventContext] for showing and dismissing toasts. Mirrors theEventContextFileDialogExtpattern fromteksilo-platform. - host
ToastHost— invisible sibling widget that owns the toast queue.- registry
ToastRegistry— the app-singleton service handle.- surface
ToastSurface— the rendered chrome of one toast.
Structs§
- Toast
- Toast — a present-able request (NOT a
Widget). Construct with one of the severity-named constructors, configure via builder methods, then call.present(ctx)orctx.show_toast(self). Internally the builder is consumed and its data is moved into a slot on the installedToastHost. - Toast
Action - One actionable element inside a
Toast— a button or hyperlink the user can click to drive a domain action. - Toast
Audience - Opaque per-app routing token. teksilo has no notion of what an
“audience” means to the host app (a document, a project, a user
session, …) — it only ever compares and hashes this value. Apps
mint their own tokens (typically one per open document/window
group) via
ToastAudience::newand pass the same value toToast::target(...)andToastRegistry::set_window_audience(...)to link the two sides of the routing decision. - Toast
Handle - Returned by
Toast::present(andctx.show_toast(toast)). Cheap to clone (Rc<Inner>). Lets app code dismiss the toast programmatically or check whether it is still alive. - Toast
Style Config
Enums§
- Toast
Action Style - How a
ToastActionshould be rendered inside the toast surface. - Toast
Dismiss Cause - Why a toast was dismissed — delivered to the
on_dismisscallback. - Toast
Priority - Queue / assertiveness level — shared with the public
Toastbuilder API. Lives here in teksilo-core so the style trait can take it in its config without depending on teksilo-widgets. - Toast
Route - Resolved delivery target for a toast (and, mirrored, its archived
NotificationEntry). - Toast
Severity - Toast severity — re-export of
BannerSeverityso apps that mixBannerandToastshare one severity vocabulary. The sameseverity.surface()/severity.glyph_color(theme)helpers apply. Banner severity level. Drives the surface tint, glyph color, and glyph shape. Apps with a “neutral” callout requirement should use aCardinstead.
Constants§
- DEFAULT_
TOAST_ AUTO_ DISMISS - Default auto-dismiss duration when the caller does not override
it (matches IntelliJ
BALLOONand Material Snackbar maximum).
Type Aliases§
- Toast
Action Callback - Type-erased callback for a
ToastAction.Fn(notFnMut) so the same callback can be wrapped in anRcand dispatched from multiple paths (tap, keyboard, AT custom action). - Toast
Dismiss Callback - Type-erased on_dismiss callback receiving the cause + context.