Toast

Toast is an animated toast component for React Native and React, from the dissolve library. Toasts that arrive in grains and leave as dust, with an optional Undo action.

Toasts that arrive in grains and leave as dust. A provider holds the stack at the top of the screen, three at most: over the limit the oldest one leaves as dust instead of vanishing.

Install

React Native

Install the engine once per app and wrap the root layout in <DissolveProvider> (see Installation), then copy the component into components/dissolve:

npx expo install dissolve-ui @shopify/react-native-skia react-native-reanimated react-native-worklets react-native-gesture-handler expo-haptics
npx dissolve-ui add toast --native
npx shadcn@latest add https://dissolve.rselmi.com/r/native/toast.json

React

Needs React 19 and react-dom, nothing else: no engine, no provider, no Tailwind. Works in the Next.js App Router.

npx dissolve-ui add toast --web
npx shadcn@latest add https://dissolve.rselmi.com/r/toast.json

Usage

Toast.tsx (React Native)
import { ToastProvider, useToast } from '@/components/dissolve/toast';

// app/_layout.tsx, inside <DissolveProvider>
<ToastProvider top={insets.top + 8}>
  <Stack />
</ToastProvider>

// any screen
const toast = useToast();

toast.show({ title: 'Changes saved', tone: 'success' });
toast.show({
  title: 'Photo deleted',
  message: 'Lisbon, 3 years ago',
  action: { label: 'Undo', onPress: restore },
});
toast.show({ title: 'Payment declined', message: 'Try another card', tone: 'error', exit: 'pixel' });
Toast.tsx (React)
import { ToastProvider, useToast } from '@/components/dissolve/toast';

// app/layout.tsx
<ToastProvider top={8}>
  {children}
</ToastProvider>

// any screen
const toast = useToast();

toast.show({ title: 'Changes saved', tone: 'success' });
toast.show({
  title: 'Photo deleted',
  message: 'Lisbon, 3 years ago',
  action: { label: 'Undo', onPress: restore },
});
toast.show({ title: 'Payment declined', message: 'Try another card', tone: 'error', exit: 'pixel' });

Props

PropTypeDefaultDescription
titlestringrequiredFirst line, one line.
messagestringSecond line, up to two lines.
tone'default' | 'success' | 'error''default'Color of the dot: gray, green or red.
action{ label, onPress }A single action, typically Undo. The toast leaves after it runs.
durationnumber3200Time on screen before it leaves on its own, ms. 0 keeps it until tapped.
enterVariantName'gather'Entrance.
exitVariantName'dust'Exit.
<ToastProvider top>number56Distance from the top of the screen.
<ToastProvider max>number3Toasts on screen at once.
<ToastProvider className>string'left-3 right-3 gap-2'Stack: side insets, gap.
<ToastProvider cardClassName>string'bg-dissolve-primary rounded-[18px]'Every card: background, radius, padding.

Source

Previous: SwipeToDelete · Next: GlossyButton · All components

dissolve is MIT licensed. Source on GitHub, package on npm. This page as markdown. For AI agents: llms.txt.