Toast

A succinct message that is displayed temporarily, providing brief feedback about an operation.

Live Demo

Click a button below to trigger each toast variant.

    Props: Toast

    PropTypeDefaultDescription
    variant'default' | 'success' | 'warning' | 'error' | 'info''default'Visual style of the toast, conveying intent.
    durationnumber4000Duration in milliseconds before the toast auto-dismisses.
    titlestringBold heading text displayed at the top of the toast.
    descriptionstringSupporting text displayed below the title.

    Usage

    // 1. Add <Toaster /> once at the app root (e.g. layout.tsx)
    import { Toaster } from '@ghiberti85/ui'
    
    export default function RootLayout({ children }) {
      return (
        <html>
          <body>
            {children}
            <Toaster />
          </body>
        </html>
      )
    }
    
    // 2. Use the hook in any client component
    'use client'
    import { useToast, Button } from '@ghiberti85/ui'
    
    export function MyComponent() {
      const { toast } = useToast()
    
      return (
        <Button onClick={() => toast({
          title: 'Saved!',
          description: 'Your changes have been saved.',
          variant: 'success',
        })}>
          Save
        </Button>
      )
    }

    View in Storybook

    Open in Storybook
    Ghiberti UI — Design System