Quick Start
Sonner is a React toast component. You canhere learn how it's built.



Installation
Install this component from the command line.
Terminal
pnpm i sonnerAdd Toaster to Your Application
It can be placed anywhere, even inside server components like layout.tsx.
layout.tsx
import { Toaster } from 'sonner';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
{children}
<Toaster />
</body>
</html>
);
}Rendering a Toast
See all options in the toast page.
import { toast } from 'sonner';
function MyToast() {
return <button onClick={() => toast('Toast')}>Render Toast</button>;
}