ask-sonner

Guides setup, usage, styling, and troubleshooting of the Sonner React toast library.

Updated Aug 11, 2026
One-click install
npx skills add https://github.com/Debindenny/travelplanner-community- --skill ask-sonner-debindenny
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ask-sonner
Source: https://github.com/Debindenny/travelplanner-community-/tree/main/travel-planner/agent/skills/ask-sonner
Command: npx skills add https://github.com/Debindenny/travelplanner-community- --skill ask-sonner-debindenny

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sonner.

What problem does it solve? Developers integrating the Sonner toast library in React often hit issues like toasts not appearing, duplicate toasts, lost styles, ignored Tailwind classes, or dark mode not applying. This Skill provides authoritative guidance on wiring up the Toaster, choosing the right toast() call, styling, and diagnosing common failures. ## Core Features & Use Cases - Setup and call selection: Mount a single <Toaster /> at the root and pick the right API — plain, typed, loading, promise-based, or headless custom toasts. - Styling and theming: An escalation ladder from defaults and richColors through classNames with !important to fully headless toast.custom(), plus icon and dark-mode theme configuration. - Troubleshooting table: Symptom-to-fix mappings for missing toasts, duplicates under StrictMode, lost stylesheets in Astro, Shadow DOM issues, stacking context problems, and stuck toast.promise calls. - Use Case: A developer's toasts render behind a modal in a Next.js app; the Skill identifies the stacking-context cause and directs moving <Toaster /> to the document root. ## Quick Start Ask how to set up Sonner in a Next.js app and show a success toast after a form submission.

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 />` in your root layout.tsx — it works inside server components — and call `toast()` from client-side event handlers or effects. Never render the Toaster per-page or conditionally, since a second mounted Toaster duplicates every toast.

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

Use `toast.promise(promise, { loading, success, error })` to tie the toast lifecycle to a promise, or manage it manually: capture the id from `toast.loading('Uploading…')` and later call `toast.success('Uploaded', { id })` to update the same toast.

Why are my Sonner toasts not appearing in React?▼

Missing toasts usually mean no `<Toaster />` is mounted, or it unmounted due to conditional or per-page rendering. Also, `toast()` is client-only — in a server action, return the result and call `toast()` from the client code that receives it.

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

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

Why does my Sonner toast appear twice in development?▼

Duplicates come from two mounted Toasters (layout and page) or from calling `toast()` inside an effect under React StrictMode's dev double-invoke. Keep one Toaster and fire toasts from event handlers, or pass a stable id so repeat calls update instead.