docs/utilities/download-trigger
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
Trigger file downloads programmatically.
PreviewCode
Hello, World! This is a sample text file.
Download
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/download-trigger
import { DownloadTrigger } from "@/registry/react/components/download-trigger";
<DownloadTrigger
data="..."
fileName="schema.json"
mimeType="application/json"
>
Download
</DownloadTrigger>
Download an SVG file by passing the SVG markup to data and setting mimeType to image/svg+xml.
PreviewCode
Download SVG
Trigger downloads from a promise that returns a Blob, File, or string. Pass a function to data.
PreviewCode
Download
| Prop | Type | Default |
|---|---|---|
data | `DownloadableData | (() => MaybePromise<DownloadableData>)` |
fileName | string | - |
mimeType | FileMimeType | - |
asChild | boolean | - |
For a complete list of props, see the Ark UI documentation.
[
Previous page
Client Only ](/docs/utilities/client-only)[
Next page
Format ](/docs/utilities/format)
On This Page
InstallationUsageExamplesDownload SVGPromiseAPI ReferenceDownloadTrigger