Download
A component that initiates a file download when clicked.
Usage
The Download component (internally using DownloadTrigger) initiates a client-side file download using in-memory data.
Render the component; when it is activated (e.g., clicked), the browser will prompt the user to download the file.
Download SVG
Pass the SVG markup as a string to data, set fileName to a .svg filename, and use mimeType "image/svg+xml".
Asynchronous Data
You can also trigger downloads from a function that returns a Promise resolving to a Blob, File, or string.
File Size
Pair the Download component with the Format.Byte component to display the file size in a human-readable format.
API Reference
Download
The component (internally using DownloadTrigger) initiates a client-side file download using in-memory data.
| Prop | Type | Default |
|---|---|---|
| data | DownloadableData | (() => MaybePromise<DownloadableData>) | - |
| fileName | string | - |
| mimeType | FileMimeType | - |
| asChild | boolean | false |

