---
title: "Download Button"
description: "A download where the whole button is the progress bar: colour sweeps across with drifting stripes, the label turns white as the fill passes, then it folds into a round check badge."
category: "Micro Interactions"
publishedAt: "2026-11-16"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/micro-interactions/download-button"
markdown: "https://beui.dev/micro-interactions/download-button.md"
license: "MIT"
---

# Download Button

> A download where the whole button is the progress bar: colour sweeps across with drifting stripes, the label turns white as the fill passes, then it folds into a round check badge.

## Install

```bash
npx shadcn@latest add @beui/download-button
```

## Dependencies

- `clsx`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"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);
        }
      }}
    />
  );
}
```

## API Reference

### DownloadButton

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `onDownload` | `((report: (progress: number) => void) => unknown)` | — | No | 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. |
| `labels` | `Partial<{ download: string; downloading: string; downloaded: string; progress: string; }>` | — | No | Override any built-in string, e.g. for translation. |
| `sound` | `boolean` | `false` | No | Play a tap on start and a success chime when done. Off by default; a `SoundProvider` can mute it app-wide. |
| `className` | `string` | — | No | Classes merged onto the root element. |

## About Download Button

Download Button is a React download control built with Framer Motion where the whole button is the progress bar. As the file comes in, colour sweeps across the pill with a bright leading edge and drifting stripes, and the label and icon turn from ink to white exactly where the fill passes, because the content is drawn twice and the top copy is clipped to the progress. The label reads Downloading with a percentage, and an arrow keeps dropping into the tray while it works. When it finishes, the pill folds into a round badge where a check pops in, then opens back into the button as the colour drains away. The fill follows real progress: onDownload receives a report function you call with a value from 0 to 1. The percentage sits in a fixed slot, so the label never shifts while it counts.

### When to use it

- A file, export or invoice downloads and the wait should be visible.
- An app installs a model, plugin or offline pack in the background.
- A report is generated before it can be saved.

### Accessibility

It renders a real button that reports aria-busy while downloading, with a progressbar named Download progress carrying the current value so screen readers can follow it. The white copy of the label is hidden from assistive technology. When it finishes, the button is named Downloaded and a polite live region announces it. With reduced motion the arrow and stripes stay still, the fill tracks progress without easing, and the fold happens without a spring.

### FAQ

**How do I show real progress?**

Pass onDownload. It receives report; call report(0.5) and so on as bytes arrive, and return a promise that settles when the download finishes. Uneven reports are smoothed into a steady sweep. Without onDownload the fill runs on its own, which suits a demo.

**What if the download fails?**

Reject the promise and the button goes back to Download.

## Source

- Registry detail: https://beui.dev/r/download-button
- Raw source: https://beui.dev/r/download-button/raw
- GitHub: https://github.com/starc007/ui-components
