ask-sonner

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

1|Updated Aug 17, 2026
One-click install
npx skills add https://github.com/NalinDalal/skillset --skill ask-sonner-nalindalal
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ask-sonner
Source: https://github.com/NalinDalal/skillset/tree/main/skills/ui/ask-sonner
Command: npx skills add https://github.com/NalinDalal/skillset --skill ask-sonner-nalindalal

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sonner.

What problem does it solve? Integrating toast notifications with Sonner often leads to subtle bugs: toasts that never appear, duplicate toasts, styles that ignore Tailwind classes, or toasts hidden behind modals. This Skill provides authoritative guidance on wiring up the Toaster, choosing the right toast() call, and diagnosing common failures. ## Core Features & Use Cases - Setup and Call Selection: Mount one <Toaster /> at the root and pick the correct API — typed toasts, toast.loading, toast.promise, action buttons, or headless toast.custom. - Styling Escalation Ladder: Progress from defaults and richColors through inline styles and classNames (with !important) to fully headless custom JSX for design-system toasts. - Troubleshooting Table: Diagnose symptoms like missing toasts, StrictMode duplicates, lost stylesheets in Astro, Shadow DOM issues, stacking-context clipping, and dark mode not applying. - Use Case: A developer's success toast renders gray instead of green and appears twice in development; the Skill identifies the missing richColors prop and the double-mounted Toaster or StrictMode effect issue. ## Quick Start Ask how to set up Sonner in a Next.js app and show a loading toast that updates to success when an upload finishes.

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 React or Next.js app?▼

Mount a single `<Toaster />` as close to the root as possible — in Next.js, place it in layout.tsx since it works inside server components. Then call `toast()` from any client-side event handler or callback; no hook or provider is needed.

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

Call `toast.loading('Uploading…')` and store the returned id, then call `toast.success('Uploaded', { id })` to update it. Alternatively, use `toast.promise(promise, { loading, success, error })` to tie the toast lifecycle directly to a promise.

Why do my Sonner toasts appear twice in development?▼

Duplicate toasts usually come from two mounted Toasters (layout and page) or from calling `toast()` inside an effect under React StrictMode's double-invoke. Keep one Toaster and fire toasts from event handlers, or pass a stable id so the second call updates instead.

Why do Tailwind classes not work on Sonner toasts?▼

Sonner's injected default styles win the CSS cascade over utility classes. Mark classes as `!important` (e.g., `!text-red-900`) via the classNames option, or use `unstyled: true` 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"` on the Toaster, or pass the resolved theme from a provider like next-themes with `<Toaster theme={resolvedTheme} />`.

Why is my Sonner toast hidden behind a modal or dialog?▼

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