Download Button
A download button that shrinks into a progress ring, counts up, then expands back with a tick and file size.
$
View as Markdownnpx shadcn@latest add https://sundaeui.dev/r/download-button.jsonOverview
Click and the label collapses into a circle whose ring fills with progress, with the percentage in the middle. When it finishes the button grows back out with a tick and "Downloaded".
Clicking the ring mid-way cancels. It takes a progress value from you, so it works with any fetch or stream.
When to use
- Exports, invoices, reports, app installers.
When not to use
- Instant downloads: a plain link is enough.
Installation
$
pnpm dlx shadcn@latest add https://sundaeui.dev/r/download-button.json$
npx shadcn@latest add https://sundaeui.dev/r/download-button.json$
yarn dlx shadcn@latest add https://sundaeui.dev/r/download-button.json$
bunx --bun shadcn@latest add https://sundaeui.dev/r/download-button.jsonWorks in any React project. Files are written to components/sundae/. Read the source in the stage’s Code view.
- No dependencies beyond React 18 or later.
- Copy download-button.tsx and download-button.css into components/sundae/.
- The CSS file is imported by the component, so no extra configuration is needed.
- Import the component and use it as shown below.
Usage
import { DownloadButton } from '@/components/sundae/download-button'
<DownloadButton />Props
| Prop | Type | Default |
|---|---|---|
progress*null = idle, 0–1 = downloading, 1 = done. | number | null | — |
onStart / onCancelActions. | () => void | — |
labelIdle label. | string | 'Download' |
sizeFile size shown beside the label. | string | — |
fillSurface: dark or light. | 'dark' | 'light' | 'dark' |
Accessibility
- While downloading, a progressbar with aria-valuenow; the ring button is named "Cancel download".
- Completion is announced politely.
- Reduced motion removes the movement and keeps every state change.
Customization
- Colours are CSS custom properties on .sd-dlb; override them in your own stylesheet.
- fill="light" switches the built-in light palette.
FAQ
- Is Download Button free?
- Yes. Download Button is free for personal and commercial projects, with full source on this page.
- How do I install Download Button?
- Run npx shadcn@latest add https://sundaeui.dev/r/download-button.json. The files are written to components/sundae/. It has no dependencies beyond React 18 or later.
- Does Download Button support keyboard and screen readers?
- While downloading, a progressbar with aria-valuenow; the ring button is named "Cancel download". Completion is announced politely.
- Does Download Button respect reduced motion?
- Reduced motion removes the movement and keeps every state change.
More like this
All components →Submit Button
Components · RefinedHold to Confirm
Components · RefinedSetup Checklist
Components · Understated- Pro
Focus Timer
Components · Refined Follow Button
Components · RefinedBookmark Button
Components · Refined