Forms
File dropzone
Drop or browse files, with a file list.
Usage
A large dashed target for dropping files or clicking to browse, with a real <input type="file"> behind it and a list of the picked files. It validates but never uploads: react to onFilesChange and feed progress back through fileStatus.
Click to upload or drag and dropPDF, DOCX or XLSX · up to 10 MB each · max 5 files
When to use
- Attachments, documents, imports and any upload where drag and drop saves time.
- One file, such as an avatar: leave
multipleoff and a new pick replaces the old.
Not for: a single quick pick inside a dense form (a plain file input is enough).
Rules and errors
accept, maxSize (bytes) and maxFiles are checked on every drop or pick. Valid files are added; each broken rule becomes an error row naming the file and the limit, announced to screen readers and dismissible. The rules text under the title is built from the same props.
Click to upload or drag and dropImages · up to 2 MB
A square photo works best. Choosing a new one replaces the old.
API
FileDropzone
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | File[] | [] | Controlled / initial list of files. |
| onFilesChange | (files: File[]) => void | — | Called with the full list when a file is added or removed. |
| onReject | (rejections: FileRejection[]) => void | — | Each has file, code ('invalid-type', 'too-large', 'too-many') and a message. |
| accept | string | — | Like <input accept>: ".pdf,.docx" or "image/*". |
| multiple | boolean | false | Several files. Off: a new pick replaces the old file. |
| maxSize / maxFiles | number | — | Largest file in bytes; most files in the list. |
| fileStatus | (file: File) => FileStatusInfo | — | { status: idle | uploading | success | error, progress?, message? } per file. |
| renderFileExtra | (file: File) => ReactNode | — | Content under a file name, e.g. a retry button. |
| title / rules / icon | ReactNode / ReactNode / IconName | — | Text and icon in the target. rules={null} hides the rules line. |
| variant | 'default' | 'compact' | 'default' | Compact is one row. |
| showList / previews | boolean | true | Show the file list; show image thumbnails (object URLs, revoked on removal). |
| name | string | — | Syncs the files into the real input so a form submits them. |
| disabled | boolean | — | Also set by a disabled Field. |
| removeLabel | (file: File) => string | — | Accessible name of a row remove button. |
Keyboard
| Key | Action |
|---|---|
| Tab | Focuses the drop target, then each remove button. |
| Enter / Space on target | On the target, opens the file picker. |
| Enter / Space on × | On a remove button, removes the file and returns focus to the target. |
Accessibility
- The target is a button named by its title and described by the rules text, so the limits are read before the picker opens.
- The real file input is hidden from assistive technology and out of the tab order; the target drives it.
- Error rows use role="alert". Each progress bar is named after its file; the remove button names the file it removes.
- Drag and drop is an extra: everything it does is also possible with the keyboard and the picker.
Motion
- Dragging over the target tints it with the primary colour and scales it to 1.01 on the snappy spring; the icon lifts 2px.
- File and error rows rise in; progress glides on the smooth spring. Reduced motion keeps the colour change only.