# Download Button

> A download button whose arrow drops into its tray, fills with progress as the percentage counts up, then draws a check and offers Open.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Components › State Changes |
| Live preview | https://uibrik.com/components/download-button |
| Writes | 1 file into `components/uibrik/download-button/` |
| Packages | `@number-flow/react`, `motion`, `react-use-measure` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 22, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/download-button.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/download-button`.

Can't run commands? https://uibrik.com/components/download-button/prompt.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { DownloadButton } from "@/components/uibrik/download-button/download-button";

<DownloadButton
  label="Download"
  doneLabel="Open"
  duration={2.8}
  resetAfter={3}
  successColor="#16a34a"
  size="md"
  onDownload={() => {}}
  onCancel={() => {}}
  onOpen={() => {}}
  // progress={0}
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/download-button.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `label` | `string` | `"Download"` | Label at rest. |
| `doneLabel` | `string` | `"Open"` | Shown once the download finishes. |
| `duration` | `number` | `2.8` | How long a simulated download takes. |
| `resetAfter` | `number` | `3` | How long the finished state shows. 0 keeps it. |
| `successColor` | `string` | `"#16a34a"` | Colour of the check once done. |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height, padding and text size. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `progress` | `number` |  | Real progress from 0 to 1. Leave out to simulate. |
| `onDownload` | `() => void` |  | Called when pressed at rest. |
| `onCancel` | `() => void` |  | Called when a download in flight is pressed again. |
| `onOpen` | `() => void` |  | Called when the finished button is pressed. |
| `className` | `string` |  | Classes for the button. |

## Where it fits

- **Exports and reports**: Progress lives inside the button, so an export never needs a separate bar or toast. Pairs with [Data Table](https://uibrik.com/components/data-table.md) (Pro).
- **Invoices and receipts**: The finished state turns into Open, the next thing people want to do. Pairs with [Billing Page](https://uibrik.com/components/billing-page.md) (Pro).
- **App and asset downloads**: Pass real progress from 0 to 1, or let it simulate one for a marketing page. Pairs with [File Card](https://uibrik.com/components/file-card.md).

## Same shelf: State Changes

- [Follow Button](https://uibrik.com/components/follow-button.md): A follow button whose plus folds into a check as it turns to Following, and warns with Unfollow on hover before you undo it.
- [Live Kbd](https://uibrik.com/components/live-kbd.md): Shortcut keycaps that sink as you press the real keys, then fire the action, so people learn the shortcut by using it.
- [Mute Toggle](https://uibrik.com/components/mute-toggle.md): A sound toggle whose waves fold away one at a time before a slash cuts through the speaker, and come back in reverse.
- [Notification Bell](https://uibrik.com/components/notification-bell.md): A notification bell that swings when something new arrives, rolls its badge count up, and drops the badge into the bell once read.
- [Password Peek](https://uibrik.com/components/password-peek.md): A password field whose eye blinks as you toggle it, and whose characters rise into view left to right instead of snapping from dots.
- [Pin Tab](https://uibrik.com/components/pin-tab.md) (Pro): A tab bar where pinning shrinks a tab to its icon and slides it to the front, and unpinning grows it back with its title.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/download-button/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
