Components
A button that downloads a file from a storage provider using a presigned download URL.
Loading preview...
"use client";
import { DownloadFile } from "@/components/ui/download-file";
import * as ReactQuery from "@tanstack/react-query";
const queryClient = new ReactQuery.QueryClient();
export default function DownloadFileDemo() {
return (
<ReactQuery.QueryClientProvider client={queryClient}>
<div className="flex min-h-[240px] items-center justify-center bg-background p-8">
<div className="flex w-full max-w-xs flex-col items-center gap-4 rounded-lg border border-border bg-card p-6 text-card-foreground shadow-sm">
<div className="text-center">
<p className="font-medium">report-2026.pdf</p>
<p className="text-sm text-muted-foreground">2.4 MB</p>
</div>
<DownloadFile
fileKey="documents/report-2026.pdf"
fileName="report-2026.pdf"
className="inline-flex items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50"
/>
</div>
</div>
</ReactQuery.QueryClientProvider>
);
}