Skip to content
Source
Sign inSign up
fuko/trytanstackdb.com
Open History to see the last commit

sonner.tsx

35 lines1.0 KB

1import { CircleAlert, CircleCheck, Info, LoaderCircle, TriangleAlert } from "lucide-react";
2import { Toaster as Sonner } from "sonner";
3import type { ToasterProps } from "sonner";
4​
5import { useThemePreference } from "@/lib/theme";
6​
7function Toaster(props: ToasterProps) {
8 const theme = useThemePreference();
9​
10 return (
11 <Sonner
12 theme={theme}
13 className="toaster group"
14 toastOptions={{ classNames: { description: "text-muted-foreground!" } }}
15 icons={{
16 success: <CircleCheck className="size-4" />,
17 info: <Info className="size-4" />,
18 warning: <TriangleAlert className="size-4" />,
19 error: <CircleAlert className="size-4" />,
20 loading: <LoaderCircle className="size-4 animate-spin" />,
21 }}
22 style={
23 {
24 "--normal-bg": "var(--popover)",
25 "--normal-text": "var(--popover-foreground)",
26 "--normal-border": "var(--border)",
27 "--border-radius": "var(--radius)",
28 } as React.CSSProperties
29 }
30 {...props}
31 />
32 );
34​
35export { Toaster };