Sonner

A modern opinionated toast notification system and alternative to Toast. Stacks notifications in a queue with auto-dismiss, rich semantic types, and promise-based toasts for async actions.

  • Stacked toast queue with auto-dismiss
  • Promise-based toast for async actions
  • Themed to match Aether UI tokens
  • Rich toast types: success, error, warning, info

import { Sonner }from "@aetherstack/ui"

sonner.tsx
"use client"

import { SonnerToaster, sonnerToast, Button } from "@/components/ui/sonner"

export function SonnerDemo() {
  return (
    <>
      <SonnerToaster />
      <div className="flex flex-wrap gap-2">
        <Button variant="outline" onClick={() => sonnerToast("Default notification")}>
          Default
        </Button>
        <Button variant="outline" onClick={() => sonnerToast.success("Saved!")}>
          Success
        </Button>
        <Button variant="outline" onClick={() => sonnerToast.error("Something went wrong")}>
          Error
        </Button>
      </div>
    </>
  )
}

Usage

All types

Fire default, success, error, and warning toasts.

With description

Add a description for more context.

Promise toast

Track async operations with loading, success, and error states automatically.

Props

PropTypeDefaultDescription

SonnerToaster

PropTypeDefaultDescription
position"top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right""bottom-right"Screen position where toasts appear.
richColorsbooleanfalseEnables richer semantic color themes for each toast type.
expandbooleanfalseExpands all toasts by default instead of stacking them.
durationnumber4000Default auto-dismiss duration in milliseconds.
closeButtonbooleanfalseRenders a close button on each toast.

sonnerToast()

PropTypeDefaultDescription
messagestring | ReactNodeThe main toast message.
descriptionstring | ReactNodeOptional secondary text below the message.
durationnumberPer-toast override for auto-dismiss duration.
action{ label: string; onClick: () => void }Optional action button rendered inside the toast.

* Required props

Accessibility

  • Sonner renders toasts in an aria-live region — screen readers announce new toasts automatically.
  • Use closeButton prop on SonnerToaster to give keyboard users an explicit dismiss control.
  • Avoid setting duration to 0 (never dismisses) for non-critical toasts — users may miss them.
  • For critical errors, prefer a Dialog or Alert component over a transient toast.