File Upload
Picks files by dragging them in, pasting them or browsing, and lists them; it doesn't upload.
Overview
FileUpload holds the use-file-upload state — accept (.pdf,.docx, image/*), maxSize, multiple + maxFiles, uncontrolled (defaultValue) or controlled (value/onChange), isDisabled — and the parts read it:
- `FileUploadDropzone`: a react-aria
DropZone, with keyboard and paste support. By default an icon, title,descriptionand a trigger, highlighted withaccentwhile a drag is over it. - `FileUploadTrigger`: a
FileTriggerbutton. - `FileUploadList`: renders each file with a function.
- `FileUploadItem`: a file-type icon or image thumbnail, name, size, optional
progress,error, extraactionssuch as retry, and a remove button that keeps focus in the widget. - `FileUploadError`: a
FieldErrorwith the validation errors (type, size, count).
Upload progress and retries stay with the app, keyed by file id.
Built-in text is in English; translate labels and error messages with i18n.
Installation
CLI
Manual
- 1
Register the @fma-ds namespace in components.json (once)
- 2
Add the item
Files land in
components/fma-ds/file-upload.tsx; npm and registry dependencies are installed along with them.
Dependencies
- npm
- cn@^0.5.0lucide-react@^1.61.0react-aria-components@^1.22.1
- Registry
- @fma-ds/button@fma-ds/field@fma-ds/file-type@fma-ds/icon-tile@fma-ds/progress@fma-ds/use-file-upload