Snackbar · Android

On this page 7

A Snackbar is a brief, non-blocking message that appears near the bottom of an Android screen to report the result of a process the user has just triggered, optionally with a single text action such as Undo or Retry. In mobile UX on Android, the Snackbar is a standard Material Design component provided by the Material Components library and by Jetpack Compose, and it sits between the silent system Toast and the interruptive dialog.

The component is defined by low interruption and short lifespan: it does not require a response, it does not block interaction with the rest of the interface, and it disappears on its own after a timeout or when the user swipes it away. Used well, it gives immediate feedback with a safety net; used badly, it hides important information in a place users rarely read.

How a Snackbar works on Android

A Snackbar works by attaching a temporary view to the nearest suitable parent of the current screen and animating it in from the bottom edge. In the View system, Snackbar.make() searches upward from the given view for a CoordinatorLayout or the window content frame, which is why a Snackbar can push a Floating action button upward instead of covering it when a CoordinatorLayout is present.

In Jetpack Compose, the model is state-driven: a SnackbarHostState holds a queue of pending messages, a SnackbarHost renders the current one, and showSnackbar() is a suspending function that returns whether the user pressed the action or the message was dismissed. This makes the outcome explicit, so code can commit or revert an operation based on the result.

Only one Snackbar is visible at a time. When a new message arrives, the current one is dismissed or the new one waits in the queue, depending on the implementation. Visibility is also coordinated with accessibility services: the system can extend the display time when TalkBack or similar services are active, because a timed message that vanishes too quickly fails users who navigate slowly.

The table below summarizes the main lifecycle stages and what controls each one.

StageWhat happensControlled by
CreationMessage text and optional action are setApp code
QueuingMessage waits if another is visibleSnackbar manager or host state
DisplayView slides in at the bottom edgeLayout and animation system
InteractionUser taps the action or swipes it awayUser
DismissalTimeout, action, swipe or replacementDuration setting and callbacks
Snackbar lifecycle on Android

Snackbar durations and content rules

The duration of a Snackbar is chosen from three standard constants, and the choice should follow the length of the text and the importance of the action. Material guidance limits content to one or two lines of text and at most one action, because a Snackbar is meant to be read at a glance.

ConstantTypical visible timeSuitable use
LENGTH_SHORT / ShortAbout 1.5 to 4 secondsSimple confirmation without action
LENGTH_LONG / LongAbout 2.75 to 10 secondsMessage with an Undo or Retry action
LENGTH_INDEFINITE / IndefiniteUntil dismissed or replacedPersistent state such as offline mode
Standard Snackbar durations

Exact timings differ between library versions and are adjusted by accessibility settings, so the values above are ranges rather than guarantees. Developers should never rely on a precise number of milliseconds. Compose also allows a dismiss action icon, which is recommended when an indefinite message is used, so the user always has a clear way to close it.

  • Write the message as a short past-tense confirmation, for example “Message archived”.
  • Label the action with a single verb, such as Undo, Retry or View.
  • Avoid icons inside the message text and never place two buttons in one Snackbar.
  • Do not use a Snackbar for critical errors that require a decision.

Snackbar compared with Toast, dialog and banner

The Snackbar is one of several feedback surfaces in Android UX, and choosing the right one depends on how urgent the message is and whether the user must act. The comparison below shows where the Snackbar fits among its neighbors.

ComponentBlocks interactionCan carry an actionTypical purpose
SnackbarNoYes, one actionConfirm an action, offer Undo
ToastNoNoSystem-level notice, also outside the app
DialogYesYes, severalDecision or confirmation before an action
BannerNoYes, one or twoPersistent, prominent status message
Bottom sheetPartlyYes, manySupplementary content or choices
Feedback components compared

The key distinction from a Toast is context and interactivity: a Toast is a system window that can appear even when the app is in the background, but it cannot hold an action, and since Android 12 text Toasts from background apps are restricted. The key distinction from a dialog is interruption cost: a dialog stops the user, while a Snackbar lets the user continue working and only offers a chance to reverse the result.

When to use a Snackbar and when to avoid it

A Snackbar is the right choice when an action has already happened, the result is reversible or easy to retry, and the information is helpful but not essential. The Undo pattern is its strongest use: instead of asking for confirmation before deleting an item, the app deletes it immediately and offers a few seconds to restore it, which removes friction for the common case.

SituationRecommended componentReason
Email moved to archiveSnackbar with UndoReversible, low risk
Upload failed on weak networkSnackbar with RetryUser can act later
Account will be permanently deletedDialogIrreversible, needs explicit consent
Device is offline for a long periodBanner or indefinite SnackbarState persists
Form field contains invalid inputInline error textError belongs to the field
Decision guide for feedback messages

Placement matters as well. On screens with Bottom navigation or a Floating action button, the Snackbar should appear above those elements rather than over them; in Compose this is usually handled by passing the host to a Scaffold. With an edge-to-edge layout, the host must respect window insets so the message does not collide with the gesture navigation area.

Common Snackbar mistakes and accessibility risks

Most Snackbar problems come from treating a transient message as reliable communication. Users may be looking elsewhere, a screen reader may announce it late, and a quick navigation can dismiss it before it is read. Anything the user must know should also be reflected in the interface itself.

  • Critical information in a Snackbar: errors that stop the workflow disappear before the user understands them.
  • Stacked or rapid-fire messages: a queue of several Snackbars feels noisy and delays each message.
  • Undo that does not truly undo: committing a deletion to the server before the timeout ends breaks trust.
  • Messages lost on navigation: showing a Snackbar right before leaving a screen often hides it immediately.
  • Poor contrast: custom colors that fail the WCAG contrast ratio of 4.5 to 1 make the text hard to read.

For accessibility, the action must remain reachable by keyboard and screen reader, and the text should be meaningful when announced alone. Indefinite messages need an explicit close control, and time-limited content should give users enough time, which is one reason the platform lengthens the duration when assistive services are on.

Explained without jargon

A Snackbar is the small strip of text that pops up at the bottom of an Android app for a few seconds after you do something, such as deleting a photo or sending a message. It tells you what just happened and then slides away on its own.

Often it carries one button, usually Undo. Think of it as a polite shop assistant who confirms the task is done and offers to reverse it, without stopping you from moving on. If the news is serious and needs your decision, the app should use a dialog instead.

A typical use case

A team building an Android email app wants deleting messages to feel fast. Instead of a confirmation dialog, swiping a message away removes it from the list at once and shows a Snackbar reading “Conversation deleted” with an Undo action and a long duration. The deletion is only sent to the server after the Snackbar is dismissed without Undo.

In testing, users clear their inbox noticeably faster because they no longer confirm each deletion, while accidental swipes are recovered with one tap. The team also places the Snackbar above the Bottom navigation and verifies that TalkBack announces it. The result is less friction with no loss of safety, which is the core promise of the Snackbar pattern.