androidx.compose.material3

SnackbarHostState

Class

No hand-written docs yet.

State of the SnackbarHost, which controls the queue and the current Snackbar being shown inside the SnackbarHost.

class SnackbarHostState

Used by

Parameters that take a SnackbarHostState.

Properties

currentSnackbarData

val currentSnackbarData

The current SnackbarData being shown by the SnackbarHost, or null if none.

Functions

showSnackbar

fun showSnackbar(
    message: String,
    actionLabel: String? = null,
    withDismissAction: Boolean = false,
    duration: SnackbarDuration = if (actionLabel == null) SnackbarDuration.Short else SnackbarDuration.Indefinite,
): SnackbarResult

Shows or queues to be shown a Snackbar at the bottom of the Scaffold to which this state is attached and suspends until the snackbar has disappeared.

fun showSnackbar(visuals: SnackbarVisuals): SnackbarResult

Shows or queues to be shown a Snackbar at the bottom of the Scaffold to which this state is attached and suspends until the snackbar has disappeared.

Library docs

State of the SnackbarHost, which controls the queue and the current Snackbar being shown inside the SnackbarHost.

This state is usually remembered and used to provide a SnackbarHost to a Scaffold.