Skip to content

Toast

Toasts live in the window layer stack rather than the application layout tree. Obtain the window-scoped handle and show a message:

auto toast = UseToast();
Button("Save").OnClick([toast] {
toast.Show("Changes saved");
})

ToastHandle::Show accepts StringVariant and ToastOptions; the default duration is two seconds. It returns a LayerId that can be dismissed early with Dismiss.

The captured environment determines theme and localized resources. ToastStyle controls placement, viewport padding, surface, typography, shadow, width, and optional motion. Toasts announce transient status through live-region semantics without taking focus.

  • UseToast() returns ToastHandle for the current window.
  • Show(StringVariant, ToastOptions = {}) -> LayerId.
  • Dismiss(LayerId) -> bool.
  • ToastOptions::duration is measured in seconds.
  • ToastStyle and VerticalPlacement define theme presentation.

See Presentation for layer lifetime and theming.