ask-sonner

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

Updated Aug 29, 2026
One-click install
npx skills add https://github.com/Seyamalam/pstu_final --skill ask-sonner-seyamalam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ask-sonner
Source: https://github.com/Seyamalam/pstu_final/tree/main/.agents/skills/ask-sonner
Command: npx skills add https://github.com/Seyamalam/pstu_final --skill ask-sonner-seyamalam

SYSTEM DOCUMENTATION & REQUIREMENTS

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 on wiring up the Toaster, choosing the right toast() call, styling, and diagnosing every common failure mode. ## Core Features & Use Cases - Setup and call selection: Mount a single <Toaster /> at the root and pick the right API — typed toasts, toast.promise, toast.loading, action buttons, or headless toast.custom. - Styling and theming: A four-rung escalation ladder from defaults and richColors through inline styles and !important classNames to fully headless custom JSX, plus icon swapping and dark-mode theming. - Troubleshooting table: Symptom-to-fix mappings for duplicate toasts, lost styles, stacking-context issues, stuck promise toasts, swipe directions, and multi-toaster targeting. - Use Case: A developer's success toast renders gray instead of green and appears twice; the Skill identifies the missing richColors prop and the duplicate Toaster mounted in both layout and page. ## Quick Start Ask how to fix a Sonner toast that is not appearing or how to show a loading toast that turns into a success message when a promise resolves.

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 toast notifications in Next.js?

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 callback; 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. Alternatively, call `toast.loading('Uploading…')`, keep the returned id, and later call `toast.success('Done', { id })` to update it in place.

Why does my Sonner toast appear twice?

Duplicate toasts usually mean two `<Toaster />` components are mounted, such as in both layout and page. It can also happen when `toast()` fires inside an effect under React StrictMode's double-invoke; fire from event handlers or pass a stable id instead.

Why do Tailwind classes have no effect on Sonner toasts?

Sonner's injected default styles win the CSS cascade over utility classes. Mark classes as important (for example `!text-red-900`), or switch to `unstyled` mode or a fully headless `toast.custom()` with your own JSX.

Does Sonner follow the system dark mode automatically?

No. The `theme` prop defaults to `'light'` and does not track the OS. Pass `theme="system"` on the Toaster, or wire it to your theme provider, such as passing `resolvedTheme` from next-themes.

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

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