# P toast 12

> Anchored deduplicated success toast

A shadcn/ui block from the [@coss](https://coss.com/ui) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/coss/p-toast-12).

- Page, with a live preview: https://shadcn.exchange/r/coss/p-toast-12
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/coss/p-toast-12-light-d9b62d146a8fab3a.png
- Registry item: https://coss.com/ui/r/p-toast-12.json
- Categories: toast, button
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://coss.com/ui/r/p-toast-12.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: `lucide-react`
- Registry items: `@coss/button`, `@coss/toast`, `@coss/tooltip`

## Files

### `registry/default/particles/p-toast-12.tsx`

```tsx
"use client";

import { SaveIcon } from "lucide-react";
import { useRef } from "react";
import { Button } from "@/registry/default/ui/button";
import { anchoredToastManager } from "@/registry/default/ui/toast";
import {
  Tooltip,
  TooltipPopup,
  TooltipTrigger,
} from "@/registry/default/ui/tooltip";

const ANCHORED_SAVE_TOAST_ID = "coss-demo-anchored-save-toast";

export default function Particle() {
  const saveButtonRef = useRef<HTMLButtonElement>(null);
  const toastTimeout = 2000;

  function handleSave() {
    if (!saveButtonRef.current) return;
    anchoredToastManager.add({
      data: {
        tooltipStyle: true,
      },
      id: ANCHORED_SAVE_TOAST_ID,
      positionerProps: {
        anchor: saveButtonRef.current,
        sideOffset: 6,
      },
      timeout: toastTimeout,
      title: "Draft saved",
    });
  }

  return (
    <Tooltip>
      <TooltipTrigger
        delay={0}
        render={
          <Button
            aria-label="Save"
            onClick={handleSave}
            ref={saveButtonRef}
            size="icon"
            variant="outline"
          />
        }
      >
        <SaveIcon aria-hidden="true" />
      </TooltipTrigger>
      <TooltipPopup>
        <p>Save</p>
      </TooltipPopup>
    </Tooltip>
  );
}
```
