Actions
Download Trigger
A trigger that serialises data to a file and downloads it on click.
Usage
import { Button, DownloadTrigger } from "@kanzo-tech/ui";DownloadTrigger wraps Ark's download-trigger machine: give it the data (a string, Blob,
File, or a function/promise returning one), a fileName and a mimeType, and it builds an
object URL and clicks it for you. It renders a <button>, so compose our Button through
asChild rather than restyling it:
<DownloadTrigger
asChild
data={csv}
fileName="open-contracts.csv"
mimeType="text/csv"
>
<Button variant="outline">Export the board</Button>
</DownloadTrigger>data may defer: pass () => fetch(url).then((r) => r.blob()) to resolve the content only when
the user clicks.
API Reference
DownloadTrigger
| Prop | Type | Default |
|---|---|---|
data | string | Blob | File | (() => MaybePromise<...>) | — |
fileName | string | — |
mimeType | FileMimeType | — |
asChild | boolean | — |