Sonner

An opinionated toast component for React.

About

Sonner is built and maintained by @emilkowalski_.

Installation

npx @kosori/cli add components sonner

Add Toaster component

Add the <Toaster /> component to the root of your app.

app/layout.tsx
import { Toaster } from '~/components/ui/sonner'; 
 
export default const RootLayout = ({ children }) => {
  return (
    <html lang='en'>
      <head />
      <body>
        <main>{children}</main>
        <Toaster /> // [!code highlight]
      </body>
    </html>
  );
}

Usage

import { toast } from 'sonner';
toast('Event has been created.');

On this page