File uploader
InputsDrag-and-drop zone plus hidden native input. Validates size, count, MIME/extension and custom rules; rejections surface in an assertive error region.
import { FileUploader } from "@componentforge/react";
Examples
Validated dropzone
Try dropping a >2 MB file or an unsupported type to see the rejection region.
Upload attachmentsPNG, JPEG or PDF · max 2 MB each
Accessibility
- Browse affordance is a real <label htmlFor> + visually-hidden <input type=file>: keyboard and screen-reader behaviour is native.
- Rejection reasons render inside role="alert" so they interrupt politely-late but reliably.
- Remove buttons carry per-file aria-labels ("Remove report.pdf").
Keyboard interactions
| Key | Action |
|---|---|
| Enter / Space | Activate Browse (native label/input behaviour). |
| Tab | Reach browse control and each remove button. |
API reference
Selected props — every component also spreads native HTML attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
| accept / multiple / maxSizeBytes / maxFiles | — | — | Declarative validation rules. |
| files / defaultFiles / onFilesChange | File[] | [] | Controlled/uncontrolled list of accepted files. |
| validate | (file: File) => string | null | — | Custom rule; return a reason string to reject. |