Snackbar

fun Snackbar(modifier: Modifier = Modifier, intent: SnackbarIntent = SnackbarDefaults.intent, style: SnackbarStyle = SnackbarDefaults.style, actionOnNewLine: Boolean = false, withDismissAction: Boolean = false, icon: SparkIcon? = null, actionLabel: String? = null, onActionClick: () -> Unit? = null, onDismissClick: () -> Unit? = null, content: @Composable () -> Unit)

Snackbars inform users of a process that an app has performed or will perform. They appear temporarily, towards the bottom of the screen. They shouldn’t interrupt the user experience, and they don’t require user input to disappear.

A Snackbar can contain a single action. Because Snackbar disappears automatically, the action shouldn't be "Dismiss" or "Cancel".

If you want to customize appearance of the Snackbar, you can pass your own version as a child of the SnackbarHost to the Scaffold

Parameters

modifier

modifiers for the Snackbar layout

intent

The intent of the Snackbar.

style

The style of the Snackbar.

withDismissAction

Whether the dismiss icon is enabled.

actionOnNewLine

whether or not action should be put on the separate line. Recommended for action with long action text

icon

icon to be shown on the start side of the content when there's no title.

actionLabel

action to add as an action to the snackbar.

onActionClick

callback when the action is clicked.

onDismissClick

Callback for dismiss icon click.


fun Snackbar(data: SnackbarData, modifier: Modifier = Modifier)

Snackbars provide brief messages about app processes at the bottom of the screen.

Snackbars inform users of a process that an app has performed or will perform. They appear temporarily, towards the bottom of the screen. They shouldn’t interrupt the user experience, and they don’t require user input to disappear.

A Snackbar can contain a single action. Because Snackbar disappears automatically, the action shouldn't be "Dismiss" or "Cancel".

If you want to customize appearance of the Snackbar, you can pass your own version as a child of the SnackbarHost to the Scaffold

Parameters

modifier

modifiers for the Snackbar layout

data

data class that contains the necessary information of a particular Snackbar have a look at SnackbarSparkVisuals , SnackbarData