# V toast 13

> Background CSV export with download action on complete

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-toast-13).

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

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-toast-13.json
```

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

## Dependencies

- Registry items: `@cnippet/toast`

## Files

### `registry/default/variants/v-toast-13.tsx`

```tsx
"use client";

import { useState } from "react";
import { Button } from "@/registry/default/ui/button";
import { toastManager } from "@/registry/default/ui/toast";

type ExportState = "idle" | "running";

export function Pattern() {
  const [state, setState] = useState<ExportState>("idle");

  const runExport = () => {
    if (state === "running") return;
    setState("running");

    const id = toastManager.add({
      description: "Preparing your CSV file…",
      timeout: 0,
      title: "Exporting data",
      type: "loading",
    });

    setTimeout(() => {
      toastManager.close(id);
      toastManager.add({
        actionProps: {
          children: "Download",
          onClick: () => {
            toastManager.add({
              description: "report-2025-q1.csv saved to your downloads.",
              title: "File saved",
              type: "success",
            });
          },
        },
        description: "1,842 rows · report-2025-q1.csv",
        timeout: 8000,
        title: "Export ready",
        type: "success",
      });
      setState("idle");
    }, 2800);
  };

  return (
    <Button
      disabled={state === "running"}
      onClick={runExport}
      variant="outline"
    >
      {state === "running" ? "Exporting…" : "Export to CSV"}
    </Button>
  );
}
```
