openrag/frontend/components/ui/sonner.tsx
2025-11-19 17:27:23 -06:00

29 lines
808 B
TypeScript

"use client";
import { useTheme } from "next-themes";
import { Toaster as Sonner } from "sonner";
type ToasterProps = React.ComponentProps<typeof Sonner>;
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme();
return (
<Sonner
theme={theme as ToasterProps["theme"]}
className="toaster group"
toastOptions={{
classNames: {
toast:
"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
description: "!text-muted-foreground",
actionButton: "!bg-primary !text-primary-foreground",
cancelButton: "!bg-muted !text-muted-foreground",
},
}}
{...props}
/>
);
};
export { Toaster };