Fusuma

Components / Components

snackbar

A line of text and the action it offers (undo, retry) in one strip.

Try it

This is the Components page of the gallery, running in your browser: snackbar is on it, and it is the real widget. Press Run, then use it.

Live: Components, where snackbar is usedOpen full size

Also on this pagealertbannerbreadcrumbsstepsgaugetile

A line of text and the action it offers (undo, retry) in one strip.

For a short message with one thing to do about it: "Message deleted" and Undo. Show it for as long as the app keeps it in the view.

Signature

pub fn snackbar<'a, M: Clone + 'a>( message: &'a str, action: &'a str, on_action: M, ) -> impl View<M> + 'a

Example

use fusuma::snackbar;
let view = snackbar("Message deleted", "Undo", ());
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.texts(), ["Message deleted", "Undo"]);

All components · Source