Skip to main content

snackbar

Function snackbar 

Source
pub fn snackbar() -> SnackbarBuilder
Expand description

§snackbar

Show a brief message with optional action and dismiss controls.

§Usage

Display transient feedback or status updates that do not interrupt the workflow.

§Parameters

  • modifier — modifier chain applied to the snackbar container.
  • message — message shown in the snackbar.
  • action_label — optional label for the action button.
  • with_dismiss_action — whether to show a dismiss action icon.
  • action_on_new_line — whether the action should be placed on a new line.
  • shape — optional shape override.
  • container_color — optional container color override.
  • content_color — optional message color override.
  • action_color — optional action color override.
  • dismiss_action_color — optional dismiss action color override.
  • content_padding — optional message insets; vertical padding excludes action controls. Explicit horizontal insets also bound the action row.
  • dismiss_action_label — accessible close-button name; defaults to Dismiss.
  • on_action — optional action callback.
  • on_dismiss — optional dismiss callback, also invoked when Escape is pressed while one of the snackbar controls has focus.

§Examples

use tessera_components::snackbar::snackbar;
use tessera_components::theme::{MaterialTheme, material_theme};
use tessera_ui::tessera;

#[tessera]
fn demo() {
    material_theme()
        .theme(|| MaterialTheme::default())
        .child(|| {
            snackbar()
                .message("Saved")
                .action_label("Undo")
                .with_dismiss_action(true)
                .on_action(|| {})
                .on_dismiss(|| {});
        });
}