Notice

A toast notification system built on Sonner, themed to match the design system.

Installation

pnpm dlx stera-ui add notice

Usage

Add <Notice /> once at the root of your app (e.g. in your layout), then trigger toasts with toast() from Sonner anywhere in your code.

import { Notice } from "@/components/ui/notice"
 
export default function Layout({ children }) {
  return (
    <>
      {children}
      <Notice />
    </>
  )
}
import { toast } from "sonner"
 
toast("Event has been created", {
  description: "Sunday, December 03, 2023 at 9:00 AM",
  action: { label: "Undo", onClick: () => {} },
})

Toast Types

MethodDescription
toast()Default notification
toast.success()Success confirmation
toast.info()Informational message
toast.warning()Caution or advisory
toast.error()Error or failure

API Reference

Notice wraps Sonner's Toaster component and forwards all props to it. The component automatically reads the current theme via next-themes.

PropTypeDefault
positionSonner position"bottom-right"
...propsAll Sonner Toaster props