animated-toast-stacked-demo
jolyui-ui/animated-toast-stacked-demoFreeExample
jolyui/ui publishes no description for this item.
Install it
npx shadcn@latest add https://jolyui.dev/r/animated-toast-stacked-demo.jsonSource
1"use client";23import { useState } from "react";4import {5 StackedNotifications,6 type StackedToast,7} from "@/registry/default/ui/animated-toast";89export default function AnimatedToastStackedDemo() {10 const [toasts, setToasts] = useState<StackedToast[]>([]);1112 const addToast = (13 type: "success" | "error" | "warning" | "info" | "default",14 ) => {15 const newToast: StackedToast = {16 id: Math.random().toString(36).substr(2, 9),17 title: `${type.charAt(0).toUpperCase() + type.slice(1)} Notification`,18 message: `This is a ${type} notification that will stack with others.`,19 type,20 };21 setToasts((prev) => [newToast, ...prev]);22 };2324 const removeToast = (id: string) => {25 setToasts((prev) => prev.filter((toast) => toast.id !== id));26 };2728 return (29 <div className="p-8">30 <div className="mb-8 flex flex-wrap gap-4">31 <button32 onClick={() => addToast("success")}33 className="rounded-md bg-green-500 px-4 py-2 text-white transition-colors hover:bg-green-600"34 >35 Add Success36 </button>37 <button38 onClick={() => addToast("error")}39 className="rounded-md bg-red-500 px-4 py-2 text-white transition-colors hover:bg-red-600"40 >41 Add Error42 </button>43 <button44 onClick={() => addToast("warning")}45 className="rounded-md bg-yellow-500 px-4 py-2 text-white transition-colors hover:bg-yellow-600"46 >47 Add Warning48 </button>49 <button50 onClick={() => addToast("info")}51 className="rounded-md bg-blue-500 px-4 py-2 text-white transition-colors hover:bg-blue-600"52 >53 Add Info54 </button>55 </div>5657 <p className="text-muted-foreground text-sm">58 Click buttons to add stacked notifications. They will appear in the59 top-right corner.60 </p>6162 <StackedNotifications63 toasts={toasts}64 onRemove={removeToast}65 maxVisible={3}66 />67 </div>68 );69}
What it pulls in
npm packages
Other registry items
Files it writes
More from jolyui/ui
All 199 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ai-prompt-box-demoai-prompt-box-demo | jolyui/ui | Examples | Free | no deps | |
| ai-prompt-box-loading-demoai-prompt-box-loading-demo | jolyui/ui | Examples | Free | no deps | |
| animated-beam-bidirectional-demoanimated-beam-bidirectional-demo | jolyui/ui | Examples | Free | 1 dep | |
| animated-beam-curved-demoanimated-beam-curved-demo | jolyui/ui | Examples | Free | 1 dep | |
| animated-beam-demoanimated-beam-demo | jolyui/ui | Examples | Free | 1 dep | |
| animated-beam-multiple-demoanimated-beam-multiple-demo | jolyui/ui | Examples | Free | 1 dep | |
| animated-table-basic-demoanimated-table-basic-demo | jolyui/ui | Examples | Free | no deps | |
| animated-table-column-demoanimated-table-column-demo | jolyui/ui | Examples | Free | no deps |
