pub fn snackbar_host() -> SnackbarHostBuilderExpand description
§snackbar_host
Display queued snackbars driven by a SnackbarHostState.
§Usage
Use with scaffold to show transient messages
above app content.
§Parameters
modifier— modifier chain applied to the host container.state— state that provides snackbar queue data.snackbar— optional custom snackbar slot for rendering.
Appearance preserves the current focus. When the final notification closes while its controls own focus, the host restores the previously focused target after layout if that target remains available. Focus moved outside the host is preserved.
§Examples
use tessera_components::snackbar::{SnackbarHostState, snackbar_host};
use tessera_components::theme::{MaterialTheme, material_theme};
use tessera_ui::{remember, tessera};
#[tessera]
fn demo() {
material_theme()
.theme(|| MaterialTheme::default())
.child(|| {
let host_state = remember(SnackbarHostState::new);
host_state.with_mut(|state| {
state.show_snackbar("Saved");
});
snackbar_host().state(host_state);
assert!(host_state.with(|state| state.is_showing()));
});
}