File Upload
FREEDrag-and-drop zone with type and size validation, image previews, file list and progress bars.
Playground
Change the props and watch the component and its code update live.
Props
Code
import { FileUpload } from "@/components/ui/file-upload";
<FileUpload
accept="image/*"
maxFiles={4}
maxSize={5 * 1024 * 1024}
onValueChange={(files) => upload(files)}
/>Installation
Terminal
npx @bloxa/cli add file-upload
# or: npx shadcn@latest add @bloxa/file-uploadExamples
Images with progress
Drop images to see previews and a simulated upload progress.
Single file
API reference
Every component also accepts the props of the element it renders.
FileUpload
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | File[] | — | Selected files. |
| onValueChange | (files: File[]) => void | — | Called when files change. |
| accept | string | — | Allowed types, e.g. "image/*,.pdf". |
| multiple | boolean | true | Multiple files. |
| maxSize | number | — | Max size per file in bytes. |
| maxFiles | number | — | Maximum number of files. |
| progress | Record<string, number> | — | Upload percentage by file name (0–100). |
| labels | { title?, browse?, hint?, ... } | — | UI strings (for translation). |