# Toast duration options

> Toast duration options

A shadcn/ui block from the [@reui](https://reui.io) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/reui/c-sonner-5).

- Page, with a live preview: https://shadcn.exchange/r/reui/c-sonner-5
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-sonner-5-light-1c31e8b49cc8f261.png
- Registry item: https://reui.io/r/new-york-v4/c-sonner-5.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://reui.io/r/new-york-v4/c-sonner-5.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `sonner`
- Registry items: `button`

## Files

### `c-sonner-5.tsx`

```tsx
import { toast } from "sonner"

import { Button } from "@/components/ui/button"

export function Pattern() {
  return (
    <div className="grid grid-cols-3 gap-2">
      <Button
        size="sm"
        variant="outline"
        className="w-full"
        onClick={() =>
          toast("Quick notice", {
            description: "Disappears in 2 seconds.",
            duration: 2000,
          })
        }
      >
        2s Duration
      </Button>
      <Button
        size="sm"
        variant="outline"
        className="w-full"
        onClick={() =>
          toast("Standard notice", {
            description: "Disappears in 5 seconds.",
            duration: 5000,
          })
        }
      >
        5s Duration
      </Button>
      <Button
        size="sm"
        variant="outline"
        className="w-full"
        onClick={() =>
          toast("Extended notice", {
            description: "Stays for 10 seconds.",
            duration: 10000,
          })
        }
      >
        10s Duration
      </Button>
      <Button
        size="sm"
        variant="outline"
        className="col-span-3 w-full"
        onClick={() =>
          toast("Persistent notice", {
            description: "This toast stays until dismissed.",
            duration: Infinity,
            closeButton: true,
          })
        }
      >
        Persistent
      </Button>
    </div>
  )
}
```
