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-hapticsnpx dissolve-ui add toast --nativenpx shadcn@latest add https://dissolve.rselmi.com/r/native/toast.jsonReact
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 --webnpx shadcn@latest add https://dissolve.rselmi.com/r/toast.jsonUsage
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' });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
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | required | First line, one line. |
message | string | Second 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. | |
duration | number | 3200 | Time on screen before it leaves on its own, ms. 0 keeps it until tapped. |
enter | VariantName | 'gather' | Entrance. |
exit | VariantName | 'dust' | Exit. |
<ToastProvider top> | number | 56 | Distance from the top of the screen. |
<ToastProvider max> | number | 3 | Toasts 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
- React Native: registry/toast.tsx
- React: registry/web/toast.tsx and registry/web/toast.core.ts
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.