Snackbar

The snackbar component consists, at minimum, of a container and a message. It also supports leading content such as an icon or trailing tertiary button.

TypeResource
DesignFigma
WebWeb Storybook
CodeGitlab
Snackbar preview

Usage

import id.co.biofarma.binduiandroid.components.snackbar.Snackbar
fun Snackbar(
    id: String = "",
    variant: String = "default",
    type: String = SnackbarType.SIMPLE.value,
    message: String = "default",
    actionLabel: String? = "default",
    iconShow: Boolean = true,
    isIcon: Any? = null,
    mode: String = ThemeMode.LIGHT.value,
    snackbarHostState: SnackbarHostState,
    dismissAction: (() -> Unit)? = null
)

Examples

Type

Use type for change the type of snackbar component: simple, action, close

Snackbar preview 2

Variant

Use variant for change variant type of snackbar component: default, primary, secondary, warning, info, danger

Snackbar preview 3

Mode (Optional)

Use mode for change color mode of snackbar component: light or dark

Snackbar preview 4

Props

PropsRequiredDefaultTypeDescription
idfalse-stringThe unique identifier for the Snackbar component, useful for accessibility or targeting specific elements.
variantfalsedefaultdefault primary secondary warning info dangerSpecifies the variant of the Snackbar, determining its visual style (e.g., default, primary, secondary, warning, info, or danger).
typefalsesimplesimple action closeDefines the type of Snackbar. simple is a basic notification, action includes an action button, and close includes a close button.
messagetrue-stringThe message to be displayed in the Snackbar, typically describing the notification or alert.
actionLabelfalse-string?Optional label for an action button inside the Snackbar, such as “Retry” or “Dismiss”.
iconShowfalsetruebooleanA flag that indicates whether to show an icon inside the Snackbar (e.g., for success, error, etc.).
isIconfalsenullAny?An optional icon to display inside the Snackbar. This can be an image, vector, or custom composable icon.
modefalselightlight darkDefines the theme mode of the Snackbar. It can be either light or dark, adjusting the visual theme.
snackbarHostStatetrue-SnackbarHostStateThe state for managing the visibility and interactions of the Snackbar. Typically passed from a SnackbarHost.
dismissActionfalsenull(() -> Unit)?An optional dismiss action, which is invoked when the Snackbar is dismissed, either by the user or automatically.
BIND © Biofarma Innovate Next-level Design .