ask-sonner
Guide to Sonner, the React toast library — install and wire up the Toaster, pick the right toast() call, promise and loading toasts, updating, dismissing and…
от Asymmetric-al★ 354 звезды на GitHub
Установить ask-sonner в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Working With Sonner
This repository (Asymmetric-al/core)
Core already ships a Sonner toaster through @asym/ui. Use this skill to
operate that existing setup, not to mount a second toaster. Reconcile this
overlay after upstream refreshes before running bun run skills:sync.
Triggers
- Toast copy, variants, promise/loading toasts, positioning, or Sonner API questions in this repo.
- Do not install a second
sonnertree or add another<Toaster />.
Workflow
- Reuse
packages/ui/components/shadcn/sonner.tsxand the@asym/ui/@asym/ui/components/shadcnre-exports. - Import
toastfromsonnerthe same way existing UI files do. - Keep theme, tokens, and layout ownership in Core's design system.
- After overlay or toaster-host refreshes, run
bun run skills:syncandbun run skills:verify.
Checklist
- No second
<Toaster />is mounted. - The existing
@asym/uitoaster is the only host. - Skill mirrors stayed in sync (
bun run skills:verify).
When invoked without a concrete task, briefly ask for the objective. If a task or question is already present, continue its workflow immediately.
A guide skill for Sonner, the toast library. When a task involves Sonner — wiring it up, rendering toasts, styling them, or fixing them — answer from this file first. Full prop tables for <Toaster /> and toast() live in API.md; read it when you need an exact prop name, type, or default.
Setup
Two pieces, and only two:
- Do not mount a Toaster. Core layouts already mount
@asym/ui's<Toaster />once. Reuse that host. A second mounted Toaster duplicates every toast. toast()called from client code — event handlers, effects, callbacks. It's a plain function, no hook or provider needed, but it does nothing on the server: in a server action, return the result and calltoast()in the client code that receives it.
import { Toaster } from "@asym/ui/components/shadcn/sonner"; // already mounted in Core layouts
import { toast } from "sonner"; // anywhere client-side
Do not import <Toaster /> from sonner and do not mount a second toaster.
Picking the right call
| You want | Call |
|---|---|
| Plain message | toast('Title') — add { description } for a second line |
| Success / error / info / warning icon | toast.success('…'), toast.error('…'), etc. |
| Spinner while you manage state yourself | toast.loading('…'), then update it by id |
| Loading → success/error tied to a promise | toast.promise(promise, { loading, success, error }) — success/error accept functions receiving the resolved value/error |
| Button that does something | { action: { label, onClick } } — closes the toast unless onClick calls event.preventDefault(); cancel is the secondary variant |
| Custom JSX, default toast shell | toast(<jsx />) |
| Custom JSX, no styles at all | toast.custom((t) => <jsx />) — headless, t gives you the id to dismiss |
Recipes
Update a toast — call toast() again with the same id; only the props you pass change. Switching to toast.success(…, { id }) changes the type. This is how loading → success flows work without toast.promise:
const id = toast.loading("Uploading…");
toast.success("Uploaded", { id });
Persist — { duration: Infinity }. Dismiss — toast.dismiss(id), or toast.dismiss() for all. Read active toasts — useSonner() in React, toast.getToasts() outside it.
Links or components in the text — pass a function for the title or description: toast(() => <a href="…">View</a>).
One toaster — Core mounts a single @asym/ui <Toaster />. Do not add a second host.
Close callbacks — onDismiss fires on close button, swipe, or toast.dismiss(); onAutoClose fires on timeout. They are separate; there is no single "closed" callback.
Styling — the escalation ladder
Climb only as far as the change requires. Exception: if you'd mark more than a few classes !important, go straight to headless — it's the rec
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- API.md
- references/LICENSE.md
- references/upstream.md
FAQ
Что делает скилл ask-sonner?
Guide to Sonner, the React toast library — install and wire up the Toaster, pick the right toast() call, promise and loading toasts, updating, dismissing and persisting toasts, styling, theming and icons, positioning and multiple toasters. Use when working with Sonner or troubleshooting it — toasts that don't appear, appear twice, lose their styles, ignore Tailwind classes, sit behind a modal, or don't follow dark mode.
Как установить скилл ask-sonner?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ask-sonner запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…