Snackbar Component
Snackbar Component
Snackbar components provide brief feedback messages at the screen bottom with optional actions. Material Design defines snackbar behavior for Android applications. Design systems extending to iOS must decide whether to adopt snackbar patterns or create platform-appropriate alternatives.
What Is a Snackbar Component
Snackbars display transient messages about app processes without blocking user interaction. They appear at screen bottom, show text with an optional action button, and disappear automatically after a timeout. Unlike alerts, snackbars do not require user acknowledgment.
Material Design specifies snackbar behavior comprehensively. Message length limits, action button styling, timing options, and positioning relative to other components all have defined guidelines.
Snackbars commonly support undo actions. After deleting an item, a snackbar confirms deletion with an Undo action that reverses the operation if tapped before the snackbar dismisses.
How Snackbar Components Work
Material Design snackbar specifications define structure, timing, and interaction. Single-line or two-line messages display with right-aligned action buttons.
Snackbar Specifications:
Structure:
- Container: Rounded corners, elevation
- Message: Text, 1-2 lines maximum
- Action: Optional, text button
- Close: Optional for longer durations
Timing:
- Short: ~4 seconds
- Long: ~10 seconds
- Indefinite: Requires dismissal action
Positioning:
- Bottom of screen
- Above bottom navigation
- Above FAB (with spacing)
- Inset from screen edges
Behavior:
- Swipe to dismiss
- Tap action to dismiss
- Auto-dismiss after timeout
- New snackbar replaces current
Implementation:
Android (Compose):
Snackbar(
action = {
TextButton(onClick = { /* undo */ }) {
Text("Undo")
}
}
) {
Text("Item deleted")
}
iOS (Custom):
// Custom implementation required
// Follow Material patterns or adapt for iOS
Positioning conventions place snackbars at screen bottom, typically 8dp above bottom navigation or screen edge. When floating action buttons are present, snackbars appear above them to avoid overlap.
Interaction patterns include auto-dismissal after timeout, swipe-to-dismiss gesture, and dismissal after action tap. Multiple snackbars do not stack; new snackbars replace existing ones.
Action buttons use text-only styling without contained backgrounds. The action appears right-aligned, using secondary or accent colors for visibility.
Key Considerations
- Message brevity keeps snackbars scannable
- Single action maximum prevents complexity
- Timeout duration matches content length
- Position adapts to bottom navigation presence
- Swipe dismissal provides quick removal
- Accessibility requires screen reader announcement
Common Questions
Should iOS applications use snackbars?
iOS has no native snackbar equivalent. Implementing snackbars on iOS is a design choice to adopt Material Design patterns on Apple platforms.
Pro: Consistency with Android if building cross-platform applications. Users get the same feedback patterns regardless of platform.
Con: Snackbars may feel foreign to iOS users accustomed to different patterns. iOS apps rarely use bottom-positioned transient messages.
Alternative iOS patterns include banners (top of screen), toast-style notifications, or inline feedback near the triggering action.
Design system choice depends on consistency priorities. Cross-platform applications may justify snackbar adoption. iOS-only applications might use platform-appropriate alternatives.
How do snackbars handle undo actions?
Undo actions appear as text buttons in the snackbar. Tapping Undo reverses the operation and dismisses the snackbar.
Implementation requires temporarily delaying the destructive action. The actual deletion happens after snackbar timeout if undo is not tapped. Alternatively, deletion happens immediately with restoration on undo.
Timeout must provide sufficient time to tap undo. Longer durations (8-10 seconds) suit actions with significant consequences.
Visual affordance should make the undo action noticeable. Contrasting color helps the action stand out from the message text.
How do multiple actions work in snackbars?
Material Design recommends single actions maximum. Snackbars are for brief feedback, not complex interaction.
If multiple actions are needed, consider alternatives. Bottom sheets, dialogs, or dedicated screens better accommodate multiple choices.
Close/dismiss can appear alongside the primary action for indefinite snackbars. This provides explicit dismissal when auto-dismiss is inappropriate.
Simplicity maintains snackbar effectiveness. Adding complexity undermines the pattern’s purpose of unobtrusive feedback.
Summary
Snackbar components provide transient bottom-screen feedback with optional undo actions following Material Design patterns. Cross-platform design systems must decide whether to adopt snackbars on iOS or use platform-appropriate alternatives. Message brevity, single action maximum, and appropriate timing maintain snackbar effectiveness. Accessibility requires screen reader announcement of snackbar content.
Buoy scans your codebase for design system inconsistencies before they ship
Detect Design Drift Free