Download Button

The whole button fills as a progress bar, then folds into a check.

Preview

"use client";

import { DownloadButton } from "@/components/motion/download-button";

export function DownloadButtonUsage() {
  return (
    <DownloadButton
      onDownload={async (report) => {
        // Replace with your download; report progress from 0 to 1.
        for (let step = 1; step <= 10; step++) {
          await new Promise((resolve) => setTimeout(resolve, 150));
          report(step / 10);
        }
      }}
    />
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/download-button

API Reference

onDownload?
((report: (progress: number) => void) => unknown)

Runs the download. Call `report` with progress from 0 to 1 to move the fill; return a promise to finish when it settles. Without it the fill runs on its own, as a demo.

Default—
labels?
Partial<{ download: string; downloading: string; downloaded: string; progress: string; }>

Override any built-in string, e.g. for translation.

Default—
sound?
boolean

Play a tap on start and a success chime when done. Off by default; a `SoundProvider` can mute it app-wide.

Defaultfalse
className?
string

Classes merged onto the root element.

Default—

Updated