Sonner
Sonner is a React and Tailwind CSS feedback component from HextaUI, licensed MIT. Copy it and paste it into your project.
HextaUI
MIT
feedback
What it is
Sonner is a React and Tailwind CSS feedback component from HextaUI, licensed MIT. Copy it and paste it into your project.
How to use it
Open it in the catalogue, press copy, and paste it into your project. The prompt you copy carries the code and the rules that tell your agent to reproduce it without changing anything.
Five free copies a month. No card.
Needs
npm i sonner next-themes
Licence
This component comes from HextaUI and is redistributed under the MIT licence, which permits commercial use. The copyright notice travels with the code.
Sonner
"use client";
import {
CircleCheckIcon,
InfoIcon,
Loader2Icon,
OctagonXIcon,
TriangleAlertIcon,
} from "lucide-react";
import { useTheme } from "next-themes";
import type * as React from "react";
import { Toaster as Sonner, type ToasterProps } from "sonner";
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "dark" } = useTheme();
return (
<Sonner
aria-atomic="true"
aria-live="polite"
className="toaster group touch-manipulation"
icons={{
success: <CircleCheckIcon aria-hidden="true" className="size-4" />,
info: <InfoIcon aria-hidden="true" className="size-4" />,
warning: <TriangleAlertIcon aria-hidden="true" className="size-4" />,
error: <OctagonXIcon aria-hidden="true" className="size-4" />,
loading: (
<Loader2Icon aria-hidden="true" className="size-4 animate-spin" />
),
}}
style={
{
"--normal-bg": "var(--popover)",
"--normal-text": "var(--popover-foreground)",
"--normal-border": "var(--border)",
"--border-radius": "var(--radius)",
} as React.CSSProperties
}
theme={theme as ToasterProps["theme"]}
{...props}
/>
);
};
export { Toaster };