GooseUI

Toast

Beautiful toast notifications with progress bar and colored variants

Preview

Installation

Sonner

Base Toaster component with theming support

npm
pnpm
yarn
bun
npx shadcn@latest add @gooseui/sonner

Custom Toast

Toast with animated progress bar and colored border

npm
pnpm
yarn
bun
npx shadcn@latest add @gooseui/custom-toast

Toast Utility

Helper functions for easy toast calls

npm
pnpm
yarn
bun
npx shadcn@latest add @gooseui/toast

Setup

Add Toaster component to your root layout

// app/layout.tsx
import { Toaster } from "@/components/ui/sonner"

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <Toaster position="top-right" />
      </body>
    </html>
  )
}

Usage

import { customToast } from "@/lib/toast"

// Success toast
customToast.success("Success!", {
  description: "Your changes have been saved"
})

// Error toast
customToast.error("Error!", {
  description: "Something went wrong"
})

// Warning toast
customToast.warning("Warning!", {
  description: "Please check your input"
})

// Info toast
customToast.info("Info", {
  description: "New update available"
})

Variants

VariantColorIcon
successGreenCircleCheckIcon
errorRedOctagonXIcon
warningAmberTriangleAlertIcon
infoBlueInfoIcon

Props

PropTypeDefaultDescription
messagestring-Toast title text
descriptionstringundefinedOptional description text
durationnumber4000Duration in milliseconds