File Upload
stableA drag-and-drop file input with validation.
Basic usage
Click to upload or drag and drop
Examples
With accepted types and size limit
Restrict uploads to images with a 5 MB size cap.
Click to upload or drag and drop
Upload constraints
FileUpload supports multiple files, accept filters, max size and max count.
Upload PDFs or images up to 5 MB
Features
- Drag-and-drop dropzone.
- accept / size / count limits.
Installation
bash
pnpm dlx structyl add file-uploadAPI Reference
FileUpload.Root
A drag-and-drop file input.
| Prop | Type | Default |
|---|---|---|
| value | File[]Controlled file list. | — |
| onValueChange | (files: File[]) => voidCalled when files change. | — |
| accept | stringAccepted MIME types / extensions. | — |
| multiple | booleanAllow multiple files. | false |
| maxSize | numberMaximum file size in bytes. | — |
| maxFiles | numberMaximum number of files. | — |
FileUpload.Dropzone
The drop target.
| Prop | Type | Default |
|---|
FileUpload.Input
The hidden native file input.
| Prop | Type | Default |
|---|