A notification component that displays brief messages to users.
Default toast notification.
import { Button } from "@/components/ui/button"
import { useToast } from "@/hooks/use-toast"
export function ToastDemo() {
const { toast } = useToast()
return (
<Button
onClick={() => {
toast({
title: "Scheduled: Catch up",
description: "Friday, February 10, 2023 at 5:57 PM",
})
}}
>
Show Toast
</Button>
)
}| Prop | Type | Default | Description |
|---|---|---|---|
| variant | default | destructive | default | The variant of the toast. |
| title | React.ReactNode | - | The title of the toast. |
| description | React.ReactNode | - | The description of the toast. |
| action | React.ReactNode | - | An action component to display. |