Branchwell

Become a Pro / website · becomeapro.ai / src / components / ui / toaster.tsx

Raw 869 B on 59dac1cc932d622dfc4d6c274a9ed8e9abcc5e5e
1"use client"
2
3import {
4 Toast,
5 ToastClose,
6 ToastDescription,
7 ToastProvider,
8 ToastTitle,
9 ToastViewport,
10} from "@/components/ui/toast"
11import { useToast } from "@/components/ui/use-toast"
12
13export function Toaster() {
14 const { toasts } = useToast()
15
16 return (
17 <ToastProvider>
18 {toasts.map(function ({ id, title, description, action, variant, ...props }) {
19 return (
20 <Toast
21 key={id}
22 variant={variant}
23 {...props}
24 >
25 <div className="grid gap-1">
26 {title && <ToastTitle>{title}</ToastTitle>}
27 {description && (
28 <ToastDescription>{description}</ToastDescription>
29 )}
30 </div>
31 {action}
32 <ToastClose />
33 </Toast>
34 )
35 })}
36 <ToastViewport />
37 </ToastProvider>
38 )
39}