Skip to content
boing

Guide

A react-hot-toast alternative with spring motion

If you like react-hot-toast’s small API but want toasts that move on springs and change in place, Boing keeps the familiar calls (toast.success, toast.error, toast.promise, <Toaster />) and swaps fixed-time slides for physics.

Try it

What stays the same

Both libraries use one <Toaster /> and a toast object you import anywhere, with no provider. The everyday calls read almost the same:

TypeScript
import { toast } from 'react-boing';

toast.success('Settings saved');
toast.error('Could not save settings');

await toast.promise(saveSettings(values), {
  loading: 'Saving…',
  success: 'Settings saved',
  error: (err) => `Save failed: ${String(err)}`,
});

What changes

  • Motion. Toasts enter, resize and leave on springs, so a toast interrupted mid-move keeps going smoothly. The animation guide explains how.
  • One toast at a time. A new message morphs the visible toast instead of adding another one. Repeats of the same message show a ×2 counter.
  • Undo built in. An action whose onClick returns a patch turns the toast into a confirmation, as in the undo guide.
  • Timing by type. Success, warning and info close after 5 seconds; errors, loading toasts and toasts with buttons stay until handled.
  • Text only. There is no custom JSX toast. You get a title, description, meta text, image, progress bar and buttons.

How do react-hot-toast calls translate?

react-hot-toastBoing
import toast, { Toaster } from 'react-hot-toast'import { toast, Toaster } from 'react-boing'
toast('Hello')toast.info('Hello')
toast.success / toast.error / toast.loadingSame names, plus toast.warning and toast.info
toast.promise(p, { loading, success, error })Same shape
toast.success('Done', { id }) to replace a toasttoast.update(id, { type: 'success', title: 'Done' })
toast.dismiss(id?)toast.dismiss(id?)
toast.remove(id?)toast.dismiss(id, { immediate: true })
toast.custom(…) and JSX messagesNo equivalent
Headless hook for your own UItoast.subscribe and toast.getState with useSyncExternalStore

duration (in milliseconds) and id carry over as options. Boing adds description, meta, image, progress and two button slots; the full list is in toast options.

When react-hot-toast is the better fit

Stay with react-hot-toast if you render custom components inside toasts, build your own toast UI on its headless hook, or simply want several toasts visible at once. Those are things it does well and Boing does not try to do.

Frequently asked questions

Can I swap react-hot-toast for Boing without changing my calls?

Close but not exact. toast.success, toast.error, toast.loading, toast.promise and toast.dismiss carry over; bare toast() calls and custom JSX toasts need changing.

Can I keep my toast.promise calls?

Yes. The messages object has the same loading, success and error keys, and success and error can be functions of the result or error.

Does Boing need an animation library?

No. It has no runtime dependencies. The springs are solved in the library and played with the Web Animations API and CSS.

Can I turn the spring bounce down?

Yes. Pass springs to toast.configure with a higher damping for enter, morph or stack.