Toast
Presents timed, stacked notifications with action, close, and swipe behavior.
Loading interactive demo…
toast_viewport("toasts").child(text("Saved"))#Import
Import Toast from quickgui.
use quickgui::*;#Usage
toast_viewport("toasts").child(text("Saved"))#Anatomy
Toast::provider_partToast::portalToast::viewportToast::positionerToast::rootToast::contentToast::titleToast::descriptionToast::actionToast::close
#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
Toast
View sourcepub fn new(title: impl Into<Arc<str>>) -> SelfCreate a toast with an auto-dismiss duration of five seconds.
descriptionpub fn description(mut self, description: impl Into<Arc<str>>) -> Self—
Configures description for this part.
pub fn description(mut self, description: impl Into<Arc<str>>) -> SelfView sourceactionpub fn action(mut self, action: impl Into<Arc<str>>) -> Self—
Label one caller-owned action control, such as *Undo*.
pub fn action(mut self, action: impl Into<Arc<str>>) -> SelfView sourcekindpub const fn kind(mut self, kind: ToastKind) -> Self—
durationpub fn duration(mut self, duration: Duration) -> Self—
Replace the auto-dismiss duration, clamped to [`MAX_TOAST_DURATION`].
pub fn duration(mut self, duration: Duration) -> SelfView sourcepersistentpub const fn persistent(mut self) -> Self—
Keep this toast until it is dismissed explicitly.
pub const fn persistent(mut self) -> SelfView sourcetitlepub fn title(&self) -> &Arc<str>—
description_textpub fn description_text(&self) -> Option<&Arc<str>>—
Configures description text for this part.
pub fn description_text(&self) -> Option<&Arc<str>>View sourceaction_labelpub fn action_label(&self) -> Option<&Arc<str>>—
toast_kindpub const fn toast_kind(&self) -> ToastKind—
duration_valuepub const fn duration_value(&self) -> Option<Duration>—
Configures duration value for this part.
pub const fn duration_value(&self) -> Option<Duration>View sourcetoast_viewport
View sourcepub fn toast_viewport(id: impl Into<ElementId>) -> ElementCreate an unstyled toast-viewport root. This shorthand is equivalent to `ToastViewport::new(id).viewport_with(div())`.
