Components / Toaster

Toaster

Stacked notifications that dismiss themselves.

Example

The component itself, running in WebAssembly, beside its code in a playground. Try it.

Code

use ravenrs::prelude::*;

fn toaster() -> impl View {
    let toasts = Toasts::new();
    let show = toasts.clone();
    VStack::new((
        Button::new("Show toast")
            .on_click(move || show.show("Report exported", "sales-q3.pdf is ready.", Tone::Success)),
        // `toasts.show_until_closed` keeps one up until it is closed.
        Toaster::new(toasts).position(ToastPosition::BottomRight),
    ))
}

Open in the playground, with every example →

Full API of Toaster →