ask-sonner

Guides setup, styling, and troubleshooting of Sonner toast notifications in React applications.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/beelabstudio/ai --skill ask-sonner-beelabstudio
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ask-sonner
Source: https://github.com/beelabstudio/ai/tree/main/skills/enabling/ask-sonner
Command: npx skills add https://github.com/beelabstudio/ai --skill ask-sonner-beelabstudio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sonner.

What problem does it solve? Sonner toasts often fail in confusing ways: they never appear, render twice, ignore Tailwind classes, hide behind modals, or ignore dark mode. This Skill provides authoritative guidance from the library's author for wiring up, styling, and debugging Sonner correctly the first time. ## Core Features & Use Cases - Setup and call selection: Mount a single <Toaster /> at the root and pick the right toast() variant — typed toasts, toast.promise, toast.loading, action buttons, or headless toast.custom. - Styling escalation ladder: Progress from richColors and inline styles through classNames with !important to fully headless custom JSX, plus icon and theme configuration. - Troubleshooting table: Diagnose duplicate toasts, lost styles in Astro or Shadow DOM, stacking-context issues, stuck toast.promise calls, and dark-mode mismatches. - Use Case: A developer's success toast renders gray instead of green and appears twice on form submit; the Skill identifies the missing richColors prop and the double-mounted Toaster causing both issues. ## Quick Start Ask how to set up Sonner in a Next.js app or why your toast is not appearing, and get an answer grounded in the library author's own guidance.

Frequently Asked Questions about ask-sonner

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Sonner toasts in a Next.js app?▼

Mount a single `<Toaster />` from the sonner package in your root layout.tsx, which works inside server components. Then call `toast()` from any client-side event handler or effect; no provider or hook is needed.

How do I show a loading toast that becomes a success toast?▼

Use `toast.promise(promise, { loading, success, error })` to tie the toast lifecycle to a promise, or call `toast.loading()` and later `toast.success('Done', { id })` with the same id to update it manually.

Why does my Sonner toast appear twice?▼

Duplicate toasts come from two mounted Toasters, such as one in the layout and one in a page, or from `toast()` firing in an effect under React StrictMode double-invocation. Keep one Toaster and fire from event handlers or pass a stable id.

Why do Tailwind classes have no effect on Sonner toasts?▼

Sonner's injected default styles win the cascade over utility classes. Mark classes with `!important` (for example `!text-red-900`), or switch to `unstyled` or headless `toast.custom()` for full control.

Does Sonner support dark mode automatically?▼

No, the `theme` prop defaults to 'light' and does not track the OS. Set `theme="system"` or pass the resolved theme from a provider like next-themes to the Toaster.

Why is my Sonner toast hidden behind a modal?▼

An ancestor element creates a stacking context via transform, filter, or overflow, or the overlay out-z-indexes the toaster. Move `<Toaster />` to the document root, outside any dialog or portal container.