Sonner 6

PreviousNext

A toast notification with action button for interactive user responses

Docs
shadcn-studiocomponent

Preview

Loading preview…
registry/new-york/components/sonner/sonner-06.tsx
'use client'

import { toast } from 'sonner'

import { Button } from '@/registry/new-york/ui/button'

const SonnerWithActionDemo = () => {
  return (
    <Button
      variant='outline'
      onClick={() =>
        toast('Action completed successfully!', {
          action: {
            label: 'Undo',
            onClick: () => console.log('Undo')
          }
        })
      }
    >
      Toast with action
    </Button>
  )
}

export default SonnerWithActionDemo

Installation

npx shadcn@latest add @shadcn-studio/sonner-06

Usage

import { Sonner06 } from "@/components/sonner-06"
<Sonner06 />