sigilUI

Sonner

Token-styled toast notifications powered by sonner. Drop in the provider and call sonnerToast.

@sigil-ui/componentsReact

Preview

Live preview Interactive

Import

import { Sonner, sonnerToast } from "@sigil-ui/components";

Setup

Add <Sonner /> once in your root layout:

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <Sonner />
      </body>
    </html>
  );
}

Trigger toasts

sonnerToast("Event created");
sonnerToast.success("Changes saved");
sonnerToast.error("Something went wrong");
sonnerToast.info("New version available");

With description and action

sonnerToast("File uploaded", {
  description: "invoice-2024.pdf was uploaded successfully.",
  action: { label: "View", onClick: () => console.log("view") },
});

Custom position

<Sonner position="top-center" />

Props

Sonner accepts all props from the sonner library's Toaster component. Token-aware class overrides are applied by default.

PropTypeDefaultDescription
positionstring"bottom-right"Toast position
toastOptionsobjecttoken-styledOverride default class names
richColorsbooleanfalseEnable rich color variants
expandbooleanfalseExpand toasts by default