Theming

Light, dark, and system

The toaster ships with two themes; system tracks prefers-color-scheme.

<sonner-toaster theme="system"></sonner-toaster>

CSS custom properties

Every color and dimension is a CSS custom property on the toaster. Override any of them in your own stylesheet:

sonner-toaster {
  --normal-bg: #1a1a1a;
  --normal-border: #2a2a2a;
  --normal-text: #fafafa;
  --border-radius: 12px;
  --width: 400px;
}
VariableDefault (light)Purpose
--width356pxToast width.
--gap14pxVertical spacing in the expanded stack.
--border-radius8pxToast corner radius.
--normal-bg#fffDefault toast background.
--normal-bordervar(--gray4)Default border.
--normal-textvar(--gray12)Default text color.
--success-bg / -border / -textgreen tripleSuccess rich-color palette.
--info-bg / -border / -textblue tripleInfo palette.
--warning-bg / -border / -textamber tripleWarning palette.
--error-bg / -border / -textred tripleError palette.
--offset-top/right/bottom/left24pxDistance from viewport edges.

Rich colors

Add the rich-colors attribute to color-code success / info / warning / error toasts:

<sonner-toaster rich-colors></sonner-toaster>

Live theme preview

Drag any control below; the toaster on this page picks up the change immediately. Click Show toast to verify.