Kinetik UI

Toast Stack

.md

Notifications that stack like cards, fan out on tap and swipe away sideways.

v1.0.0Live on webreact-native-gesture-handlerreact-native-reanimatedreact-native-safe-area-contextreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add toast-stack

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/toast-stack.json

Install manually

  1. Install dependencies
    npx expo install react-native-gesture-handler react-native-reanimated react-native-safe-area-context react-native-worklets
  2. Copy the source files
    • components/kinetik/toast-stack.tsx
    View source files

Usage

import { ToastProvider, useToast } from '@/components/kinetik/toast-stack';

// Once, near the root (inside GestureHandlerRootView and SafeAreaProvider):
<ToastProvider>
  <App />
</ToastProvider>;

// Anywhere below it:
const toast = useToast();
toast.show({ title: 'Card removed', action: { label: 'Undo', onPress: restore } });
toast.show({ title: 'Payment failed', description: 'Try another card.', tone: 'danger' });

show returns an id you can pass to dismiss. dismissAll clears the stack.

When to use

  • Short, non-blocking confirmations and errors that do not need a decision.
  • Offering a quick Undo after an action.

When not to use

  • Errors the user must fix before continuing. Show them inline next to the field or action.
  • Long messages or several actions. Use a sheet or a dialog.

Notes

  • Up to max toasts (3) stay in the stack; older ones animate out.
  • Tapping the stack fans it out into a list and pauses every timer until it collapses again.
  • Swipe a toast sideways past 30% of the screen, or fling it, to dismiss.
  • success, warning and danger toasts play the matching haptic; every toast is announced to screen readers.
  • Set safeArea={false} when the provider wraps a small region instead of the whole screen.

Props

ToastOptions

PropTypeDefaultDescription
titlerequiredstring—
descriptionstring—
toneToastTone—Defaults to `neutral`.
durationnumber | null—Auto-dismiss after this many ms. `null` keeps it until dismissed. Defaults to the provider's duration.
action{ label: string; onPress: () => void }—One optional action, e.g. Undo. Pressing it dismisses the toast.

ToastProviderProps

PropTypeDefaultDescription
childrenrequiredReactNode—
placement'top' | 'bottom''top'Defaults to `top`.
durationnumber4000Default auto-dismiss time in ms. Defaults to 4000.
maxnumber3Toasts kept in the stack; older ones are dropped. Defaults to 3.
offsetnumber8Distance from the safe-area edge, in pt. Defaults to 8.
hapticsbooleantruePlays a haptic for success, warning and danger toasts. Defaults to true.
safeAreabooleantrueKeep clear of the status bar and home indicator. Turn off when the provider wraps a small region rather than the screen. Defaults to true.

Performance and accessibility

Performance

Budget
Springs run only while toasts enter, re-stack, expand or leave; swipes track on the UI thread.
Measured

Pixel 9 emulator, API 35, release build · interaction median 0.95× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 142 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
Toasts fade in and out in place; no slide, scale or fly-out.
Screen readers
Each toast is announced when shown and exposed as an alert with a 'Dismiss' action; the Undo-style action is its own button.
Touch target
Action buttons are at least 44 pt tall.

Source files

components/kinetik/toast-stack.tsx is in the Code tab of the preview above.