CustomSnackbar

fun CustomSnackbar(snackbarData: SnackbarData, modifier: Modifier = Modifier, actionOnNewLine: Boolean = false, textStyle: TextStyle = MaterialTheme.typography.h3, shape: Shape = MaterialTheme.shapes.small, backgroundColor: Color = SnackbarDefaults.backgroundColor, contentColor: Color = MaterialTheme.colors.surface, actionColor: Color = SnackbarDefaults.primaryActionColor, elevation: Dp = 6.dp)

Material Design snackbar.

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 they disappear automatically, the action shouldn't be "Dismiss" or "Cancel".

Snackbars image

This version of snackbar is designed to work with SnackbarData provided by the SnackbarHost, which is usually used inside of the Scaffold.

This components provides only the visuals of the Snackbar. If you need to show a Snackbar with defaults on the screen, use ScaffoldState.snackbarHostState and SnackbarHostState.showSnackbar:

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

snackbarData

data about the current snackbar showing via SnackbarHostState

modifier

modifiers for the Snackbar layout

actionOnNewLine

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

shape

Defines the Snackbar's shape as well as its shadow

backgroundColor

background color of the Snackbar

contentColor

color of the content to use inside the snackbar. Defaults to either the matching content color for backgroundColor, or, if it is not a color from the theme, this will keep the same value set above this Surface.

actionColor

color of the action

elevation

The z-coordinate at which to place the SnackBar. This controls the size of the shadow below the SnackBar