Sonner/sonner-interactive-

PreviousNext

A sonner/sonner-interactive- example

Docs
shadcnblocksblock

Preview

Loading preview…
code/example/sonner/sonner-interactive-1.tsx
"use client";

import { toast } from "sonner";

import { Button } from "@/components/ui/button";

export const title = "Toast with Action Button";

const Example = () => (
  <Button
    onClick={() =>
      toast("Event has been created", {
        action: {
          label: "Undo",
          onClick: () => toast.success("Action clicked"),
        },
      })
    }
    variant="outline"
  >
    Show Toast
  </Button>
);

export default Example;

Installation

npx shadcn@latest add @shadcnblocks/sonner-sonner-interactive-1

Usage

import { SonnerSonnerInteractive1 } from "@/components/sonner-sonner-interactive-1"
<SonnerSonnerInteractive1 />