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.
| Stage | What happens | Controlled by |
|---|---|---|
| Creation | Message text and optional action are set | App code |
| Queuing | Message waits if another is visible | Snackbar manager or host state |
| Display | View slides in at the bottom edge | Layout and animation system |
| Interaction | User taps the action or swipes it away | User |
| Dismissal | Timeout, action, swipe or replacement | Duration setting and callbacks |
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.
| Constant | Typical visible time | Suitable use |
|---|---|---|
| LENGTH_SHORT / Short | About 1.5 to 4 seconds | Simple confirmation without action |
| LENGTH_LONG / Long | About 2.75 to 10 seconds | Message with an Undo or Retry action |
| LENGTH_INDEFINITE / Indefinite | Until dismissed or replaced | Persistent state such as offline mode |
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.
| Component | Blocks interaction | Can carry an action | Typical purpose |
|---|---|---|---|
| Snackbar | No | Yes, one action | Confirm an action, offer Undo |
| Toast | No | No | System-level notice, also outside the app |
| Dialog | Yes | Yes, several | Decision or confirmation before an action |
| Banner | No | Yes, one or two | Persistent, prominent status message |
| Bottom sheet | Partly | Yes, many | Supplementary content or choices |
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.
| Situation | Recommended component | Reason |
|---|---|---|
| Email moved to archive | Snackbar with Undo | Reversible, low risk |
| Upload failed on weak network | Snackbar with Retry | User can act later |
| Account will be permanently deleted | Dialog | Irreversible, needs explicit consent |
| Device is offline for a long period | Banner or indefinite Snackbar | State persists |
| Form field contains invalid input | Inline error text | Error belongs to the field |
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.