Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Sonner for React

Toast notifications powered by Sonner.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/aria/sonner.json

Usage

Add Toaster once, then call toast.

import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { Toaster } from "@/components/ui/sonner";
<>
  <Toaster />
  <Button
    variant="outline"
    onClick={() => toast("Event has been created")}
  >
    Show Toast
  </Button>
</>

Demos

Types

Status toasts and a promise toast.

Description

Toast with a description.

Position

Place the toast with the position option.

API Reference

toast

createToaster

Toaster

PropType
AttributeType
CSS variableType
--borderstring
--popoverstring
--popover-foregroundstring
--radiusstring