Search

Search the site

All components

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

1"use client";
2
3import { FileUpload } from "@/registry/ui";
4
5export function FileUploadDefaultExample() {
6 return (
7 <div className="mx-auto w-full max-w-4xl">
8 <FileUpload
9 onUpload={async (_, onProgress, signal) => {
10 // Fake real upload
11 return new Promise((resolve, reject) => {
12 let progress = 0;
13
14 const interval = setInterval(() => {
15 if (signal.aborted) {
16 clearInterval(interval);
17 reject(new Error("Cancelled"));
18 return;
19 }
20
21 progress += 10;
22 onProgress(progress);
23
24 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

NameTypeDefaultDescription
onUpload() => voidundefinedCallback when a file is uploaded