File Upload
A component for uploading files
Default
Default file upload
Upload your files
Drag & drop or click to browse
Images & PDFs up to 5MB
default-example.tsx
1"use client";23import { FileUpload } from "@/registry/ui";45export function FileUploadDefaultExample() {6 return (7 <div className="mx-auto w-full max-w-4xl">8 <FileUpload9 onUpload={async (_, onProgress, signal) => {10 // Fake real upload11 return new Promise((resolve, reject) => {12 let progress = 0;1314 const interval = setInterval(() => {15 if (signal.aborted) {16 clearInterval(interval);17 reject(new Error("Cancelled"));18 return;19 }2021 progress += 10;22 onProgress(progress);2324 if (progress >= 100) {25 clearInterval(interval);26 resolve();27 }28 }, 200);29 });30 }}31 />32 </div>33 );34}
Installation & source
Install via the shadcn CLI or copy the registry files manually.
bash
npx shadcn@latest add @tt-ui/file-upload
Props
| Name | Type | Default | Description |
|---|---|---|---|
| onUpload | () => void | undefined | Callback when a file is uploaded |