# Toast with custom rich content

> Toast with custom rich content

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

- Page, with a live preview: https://shadcn.exchange/r/reui/c-sonner-9
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/reui/c-sonner-9-light-eb7c93126b75a26c.png
- Registry item: https://reui.io/r/new-york-v4/c-sonner-9.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-9.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: `avatar`, `button`

## Files

### `c-sonner-9.tsx`

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

import {
  Avatar,
  AvatarFallback,
  AvatarImage,
} from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"

export function Pattern() {
  const showUserToast = () => {
    toast.custom(() => (
      <div className="bg-popover text-popover-foreground border-border rounded-md flex w-[356px] items-start gap-3 border p-4 shadow-lg">
        <Avatar className="size-9 shrink-0">
          <AvatarImage
            src="https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=96&h=96&dpr=2&q=80"
            alt="Alex Johnson"
          />
          <AvatarFallback>AJ</AvatarFallback>
        </Avatar>
        <div className="flex flex-1 flex-col gap-1">
          <div className="flex items-center justify-between">
            <p className="text-sm font-semibold">Alex Johnson</p>
            <span className="text-muted-foreground text-xs">2m ago</span>
          </div>
          <p className="text-muted-foreground text-sm">
            Hey! I&apos;ve finished the design review. Let me know when
            you&apos;re free to discuss.
          </p>
          <div className="mt-2 flex gap-2">
            <Button size="xs" variant="outline" onClick={() => toast.dismiss()}>
              Dismiss
            </Button>
            <Button size="xs" onClick={() => toast.dismiss()}>
              Reply
            </Button>
          </div>
        </div>
      </div>
    ))
  }

  return (
    <div className="flex items-center justify-center">
      <Button onClick={showUserToast} variant="outline" className="w-fit">
        User Message Toast
      </Button>
    </div>
  )
}
```
