Gooey Toast

A morphing toast notification with smooth, gooey animations and autopilot expansion.

Installation

npx love-ui@latest add gooey-toast

Add the Toaster component to your app.

app/layout.tsx
import { Toaster } from "@loveui/gooey-toast"
 
export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <head />
      <body>
        <main>{children}</main>
        <Toaster />
      </body>
    </html>
  )
}

Usage

import { gooey } from "@loveui/gooey-toast"
gooey.show({
  title: "Event has been created",
  description: "Monday, January 3rd at 6:00pm",
})

By default, toasts appear in the top-right corner with automatic gooey morphing animations. You can change the position by setting the position prop on individual toasts or globally on the Toaster component.

Allowed values: top-left, top-center, top-right, bottom-left, bottom-center, bottom-right.

<Toaster position="bottom-center" />

Examples

States

Gooey Toast supports different states with contextual colors and icons.

Promise

Drive toast states from promises for async operations.

With Action Button

Add interactive buttons to your toasts.

Position

Control where toasts appear on the screen.

API Reference

gooey

The main API for showing toasts.

Methods

  • gooey.show(options) - Show a basic toast
  • gooey.success(options) - Show a success toast
  • gooey.error(options) - Show an error toast
  • gooey.warning(options) - Show a warning toast
  • gooey.info(options) - Show an info toast
  • gooey.action(options) - Show an action toast
  • gooey.promise(promise, options) - Drive toast from promise states
  • gooey.dismiss(id) - Dismiss a specific toast
  • gooey.clear(position?) - Clear all toasts or toasts at a specific position

Options

interface GooeyOptions {
  title?: string
  description?: ReactNode | string
  position?: GooeyPosition
  duration?: number | null // null for persistent
  icon?: ReactNode | null
  styles?: GooeyStyles
  fill?: string // Background color
  roundness?: number // Border radius
  autopilot?: boolean | { expand?: number; collapse?: number }
  button?: {
    title: string
    onClick: () => void
  }
}

Toaster Props

interface GooeyToasterProps {
  position?: GooeyPosition // Default position for all toasts
  offset?: number | string | {
    top?: number | string
    right?: number | string
    bottom?: number | string
    left?: number | string
  }
  options?: Partial<GooeyOptions> // Default options for all toasts
}

Features

  • Gooey Morphing: Smooth, organic shape transitions between states
  • Autopilot Mode: Automatic expansion/collapse for better readability
  • Promise-driven: Seamlessly handle async operations
  • Customizable: Control colors, roundness, duration, and positioning
  • Action Buttons: Add interactive elements to toasts
  • Multiple Positions: Support for 6 different screen positions
  • Spring Animations: Natural, physics-based motion