SwipeUI

Snackbar

Single-action notifications sharing the toast queue.

npx @swipeui/cli add snackbar
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • A reversible result with one named application action, such as Undo or Retry.

When not to use it

  • Decisions, long instructions or multiple business actions: use Dialog.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add snackbar
  • Adds components/swipeui/ui/snackbar.tsx and 12 shared helpers.
  • Installs react-native-gesture-handler, react-native-reanimated, react-native-safe-area-context, react-native-worklets, react-native-svg, uniwind, clsx, tailwind-merge, expo-haptics, class-variance-authority. In Expo apps it uses npx expo install so versions match your SDK.

Usage

useSnackbar().show({ title: "Archived", action: { label: "Undo", onPress: undo } });

Feedback lineup settings

PropDoes / default
title / presetMessage content; explicit title and description override a preset.
actionRequired named application action, beside a short message. Invokes the callback once and dismisses.
duration0 with an action: persistent unless explicitly timed.
iconnull; pass a custom node or undefined to show the tone symbol.
showDismissfalse; opt into a separate 44pt close control. Undo, swipe and the accessibility dismiss action remain available.
descriptionOptional detail. Detailed messages place the action below the text.

Both <Snackbar /> and useSnackbar().show() use these defaults and share one ToastProvider/ToastHost. The content-sized surface wraps long text without a fixed height. Native Dynamic Type, VoiceOver and RTL review remain in 7.9.

The shared archive example uses a bounded conversation card, a rolling Inbox/Archived tag, Undo and an explicit three-second lifetime with exitDirection="up". Direct Snackbar calls still default to persistent action availability; provide duration to opt into expiry.

Archive is the single shared demo board; its Undo action, upward expiry and long-press stack gestures use the same notification queue as Toast. Previous Top/Undo examples are consolidated.

Behavior and gestures

  • Persistent until acted on or dismissed unless duration is explicitly set.
  • Same safe-area placement, queue, swipe and accessibility pause behaviour as Toast.

Accessibility

  • The message is announced when it appears.
  • Native screen-reader mode keeps toasts persistent. On the web, focused controls pause expiry; browsers cannot detect screen-reader presence.
  • Action and dismiss are named buttons, so swiping is never required.
  • Toasts never take focus or block the screen.

Motion

  • Uses the overlay and press motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • Toasts fade in and out on the overlay role; swipes follow the finger.
  • Reduce Motion uses a short fade.

Performance

  • One host at the app root renders the queue; it doesn't depend on your router.

Notes for AI

  • Use useSnackbar inside ToastProvider. One ToastHost displays both toasts and snackbars.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items