toast · git:20260902.51b89ce · 2026-09-02 · sha256 4f3300739d94a55f
toast git:20260902.51b89ceA
Immutable. This exact content is served forever at /api/v1/blob/4f3300739d94a55f.
---
description: Toast variants and toast() API — default, error, warning, info
globs: src/components/atoms/Toast/**,src/components/molecules/Toaster/**,src/hooks/**,src/providers/**/*
alwaysApply: false
---
# Toast Rules
@docs/components.md — _Toasts_
## Variants
Use `variant` on `toast()` — never `className: 'destructive …'` or `showErrorToast` / `showSuccessToast` helpers.
| Variant | When |
|---------|------|
| `default` | Success, confirmation (omit `variant`) |
| `error` | Failures; omit `title` for the generic `Error` title |
| `warning` | Caution, rate limits |
| `info` | Neutral info (e.g. clipboard copy) |
## API
```tsx
import { toast } from '@/molecules/Toaster/toast';
toast({ variant: 'error', description: '...' });
toast({ title: 'Saved', description: '...' }); // default
toast({ title: 'Reposted', action: { label: 'Undo', altText: 'Undo', onClick: () => {} } });
```
`toast()` is the only public producer API; `toast.store.ts`, `useToastState.ts`, and the `@/atoms/Toast/*` renderer atoms are Toaster-internal (ESLint-enforced). Custom actions are descriptors (`{ label, altText, onClick }`), never components — the Toaster renders and styles them. Styling: [`Toast.variants.ts`](src/components/atoms/Toast/Toast.variants.ts) only.