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. "Dismiss" or "cancel" actions are optional.
Snackbars with an action should not timeout or self-dismiss until the user performs another action. Here, moving the keyboard focus indicator to navigate through interactive elements in a page is not considered an action.
This component provides only the visuals of the Snackbar. If you need to show a Snackbar with defaults on the screen, use SnackbarHostState.showSnackbar:
Parameters
the Modifier to be applied to this snackbar
action / button component to add as an action to the snackbar. Consider using ColorScheme.inversePrimary as the color for the action, if you do not have a predefined color you wish to use instead.
action / button component to add as an additional close affordance action when a snackbar is non self-dismissive. Consider using ColorScheme.inverseOnSurface as the color for the action, if you do not have a predefined color you wish to use instead.
whether or not action should be put on a separate line. Recommended for action with long action text.
defines the shape of this snackbar's container
the color used for the background of this snackbar. Use Color.Transparent to have no color.
the preferred color for content inside this snackbar
the preferred content color for the optional action inside this snackbar
the preferred content color for the optional dismissAction inside this snackbar
content to show information about a process that an app has performed or will perform
Samples
androidx.compose.material3.samples.ScaffoldWithSimpleSnackbarandroidx.compose.material3.samples.ScaffoldWithCustomSnackbarandroidx.compose.material3.samples.ScaffoldWithMultilineSnackbarSnackbars 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. "Dismiss" or "cancel" actions are optional.
Snackbars with an action should not timeout or self-dismiss until the user performs another action. Here, moving the keyboard focus indicator to navigate through interactive elements in a page is not considered an action.
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 SnackbarHostState.showSnackbar:
Parameters
data about the current snackbar showing via SnackbarHostState
the Modifier to be applied to this snackbar
whether or not action should be put on a separate line. Recommended for action with long action text.
defines the shape of this snackbar's container
the color used for the background of this snackbar. Use Color.Transparent to have no color.
the preferred color for content inside this snackbar
the color of the snackbar's action
the preferred content color for the optional action inside this snackbar. See SnackbarVisuals.actionLabel.
the preferred content color for the optional dismiss action inside this snackbar. See SnackbarVisuals.withDismissAction.