Guide
Boing toasts in a shadcn/ui project
To use Boing as the toast in a shadcn/ui app, render its <Toaster /> in your layout and point its --boing-* CSS variables at your shadcn theme tokens. The toasts then use your colours, radius and font in light and dark mode.
Install and render the Toaster
Boing is a regular npm package, not a component copied into your repo, so there is no components/ui file to add. Render <Toaster /> in the root layout as in the Next.js guide, then call toast.success(…) from client components.
Match the shadcn theme with CSS variables
shadcn/ui keeps its palette in CSS variables such as --popover, --border and --radius. Point Boing’s variables at them in your global stylesheet:
- Keep this rule outside
@layer baseor any other layer. Boing’s stylesheet is not in a layer, and unlayered CSS wins over layered CSS no matter the order. - Newer shadcn themes store full colours (often
oklch(…)), sovar(--popover)works as is. Older themes store bare HSL numbers; wrap those ashsl(var(--popover)). font-family: inheritswaps Boing’s system font stack for the one your app sets onbody.- Leave
--boing-radiusout if you prefer the default pill shape.
The full list of variables is in the docs, and the playground shows them live.
Follow class-based dark mode
With theme="system" (the default) the Toaster follows the operating system setting. Most shadcn apps switch themes with a dark class from next-themes instead, so pass the resolved theme through:
Render <AppToaster /> inside your ThemeProvider. The variables mapped above already change with the dark class; the theme prop makes the parts you did not map, such as the status icon colours, switch with them.
When to keep the shadcn Sonner toast
The toast that shadcn/ui installs today is a themed wrapper around Sonner. It is a good default, and switching is not always worth it. Keep it when:
- You want several toasts stacked on screen at once as the normal behaviour.
- You render custom JSX inside toasts. Boing shows text, an optional image, a progress bar and up to two buttons.
- The toast already looks the way you want and nobody has asked for a change.
Boing fits better when you want one toast that changes in place, spring motion, an undo button that morphs into a confirmation, or built-in sounds. The Sonner comparison goes through the differences call by call.
Frequently asked questions
Is there a shadcn registry item for Boing?
No. Boing installs from npm as react-boing and is styled with CSS variables, so there is no component file to copy in.
Can I run Boing and the shadcn Sonner toaster side by side?
They do not conflict, since each has its own Toaster and its own toast import. Two toast systems on one screen is confusing for users, though, so it is best kept to a migration period.
Why does my CSS override not apply?
Check that the rule is not inside an @layer block. Boing adds its styles without a layer, and unlayered rules always beat layered ones.
How do I make toasts follow the dark class from next-themes?
Read resolvedTheme from useTheme() in a small client component and pass it to the Toaster theme prop.
Related guides
- Next.js toast notifications in the App Router (Boing)Toasts in a server-first app.
- Sonner alternative that shows one toast at a timeOne toast that morphs instead of a stack.
- Toast playgroundPick a style, tweak it, copy the code.
- Boing docsSetup, options, styling, sound and accessibility.