File upload
A drop zone that is fully operable from the keyboard, with local file listing, size validation and removal.
Live preview
Source
The exact file rendered in the preview above.
components/demos/file-upload.tsx
components/ui/file-upload.tsx
Demo source — adapt to your project. Foundry is not published as a package.
Usage
The visible surface is a button, not a div with a drop handler, so Space and Enter open the picker. Drag-and-drop is an enhancement on top of that, never the only way in.
- State the accepted formats and size limit in the hint before a user picks the wrong file.
- Nothing is uploaded in this demo — selected files are listed locally and can be removed.
- Removing a file resets the native input value so the same file can be chosen again.
Variants and states
Every entry below is a genuine difference in behaviour or layout, and every one of them is visible in the preview above.
- Single file
- Multiple files
- Size-limited
- Disabled
- Error
Accessibility
- Keyboard
- The drop zone is a `<button>`; the file input is visually hidden but present for form submission.
- Errors
- Validation failures are announced through `role="alert"`.
- File list
- Selected files are a labelled list, and each remove button names its file.
Foundry implements published ARIA patterns and is tested against them. No WCAG certification is claimed — see the accessibility documentation for what is and is not covered.
Related
All componentsField
The accessibility contract shared by every form control — label, help text, error, success and the ARIA wiring that connects them.
intermediateFeatured7 variantsJob application
One open question instead of a cover letter, with an optional CV and no demographic fields.
starter4 variantsEmpty state
The three-part empty state — what is missing, why, and the single most likely next action.
starter4 variants