FileInputZone
Lets a member upload a file, by dropping it or browsing. Wraps a native file input, and its text can be localised.
Health
Source
Design
Playground
No Example
Accessibility
unknown
Platform
Web
- Overview
- Props
- Figma
Basic Usage
Drag and drop your file
or
Multiple files
Drag and drop your files
or
Customized locales
You can pass a locales object to customize the text displayed in the component.
Drag and drop only one file
or you click on the button below
Caveats
This component is using HTML <input type="file"/>. To seed it with an existing list of files (e.g. state kept alive across a remount), pass initialFiles — it is only used once, at mount.
FileInputZone props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| allowMultipleFiles | booleanundefined | false | Allow the user to upload multiple files | |
| disabled | booleanundefined | Disable the component | ||
| dropzoneOptions | DropzoneOptionsundefined | Dropzone options see available options on https://react-dropzone.js.org/#src | ||
| errorMessage | stringundefined | Show the error message | ||
| fullMode | booleanundefined | false | Make the component take full height available | |
| initialFiles | File[]undefined | Seeds the internal files list once, on mount. Use this to keep the list in sync with a file list owned outside this component (e.g. state that outlives a remount) | ||
| isLoading | booleanundefined | false | Replaces the label and accepted formats with a loader, keeping their height so the layout doesn't shift | |
| keepFilesInLocalStorageWithId | stringfalseundefined | false | If files should be persisted between refreshes or rerender of component, please provide an ID to this component that can be used to fetch past files | |
| locales | 11 possibilities{ filesListTitle?: stringundefined; label?: { singular?: stringundefined; plural?: stringundefined; }undefined; acceptedFormats?: stringundefined; or?: stringundefined; buttonLabel?: { singular?: stringundefined; plural?: stringundefined; }undefined; }undefined | {} | Customize the text displayed | |
| onChange | ((files: File[]) => void)undefined | Handler called when files list have been updated | ||
| showFileList | booleanundefined | true | ||
| showFilesPreview | booleanundefined | true | Show the files preview in the files list |