Snackbar

A brief message at the bottom of the screen about something the app did, with an optional action like Undo.
Stable
Web
iOS
Android
@advui/core
Source

With Undo

Archived: 0

Installation

pnpm
pnpm add @advui/core
npm
npm install @advui/core

Usage

import { Snackbar } from '@advui/core'

<Snackbar
  open={open}
  onOpenChange={setOpen}
  action={{ label: 'Undo', onPress: undo }}
>
  Conversation archived
</Snackbar>

Examples

Stays until dismissed

For states that last, like being offline.

API reference

Snackbar

PropTypeDefaultDescription
open requiredboolean—Whether it is shown.
onOpenChange required(open: boolean) => void—Called when it closes by itself, from the action or the close button.
children requiredReactNode—The message.
action{ label: string; onPress: () => void }—One action, such as Undo. Pressing it also closes the snackbar.
durationnumber | null4000, or 8000 with an actionMilliseconds before it closes by itself; `null` keeps it open.
showClosebooleanduration === nullShow a close (×) button.

Accessibility

  • The message sits in a polite live region (role="status") that stays mounted, so screen readers announce it without moving focus. On iOS it is announced with AccessibilityInfo.
  • The timer pauses while the pointer or keyboard focus is on the snackbar, and it runs longer when there is an action, so people have time to reach it.
  • Actions are optional shortcuts: never put the only way to do something in a snackbar. Use duration={null} for messages that must stay.
  • Colors use the inverse surface with inversePrimary for the action, checked for WCAG AA contrast.
Keyboard interactions
KeyAction
TabReaches the action and the close button (it does not take focus).
Enter / SpaceRuns the focused action.

Responsive behavior

Full width minus 16px margins on phones; centered and at most 576px wide on larger screens.

Platform notes

Web
Rendered in a portal above the page, like toasts.
iOS
Rendered in a native portal; keep it above the home indicator by giving the app safe-area insets.
Android
Announced through a polite live region. With androidRipple (on in material()), presses show the native ripple.
Since v0.2.0Last updated Nov 2, 2026Edit this page on GitHub