File upload
File upload component with drag and drop, accepted types, maximum size, multiple files and a list with remove buttons.
How to use it
Run npx @blossomui/react add file-upload, or copy src/components/UI/FileUpload/FileUpload.tsx into your React project and import it.
import { FileUpload } from './components/ui/FileUpload'Props
FileUploadProps
| Prop | Type | Description |
|---|---|---|
| labels | { hint?: string; remove?: (name: string) => string } | Texts of the component. Pass only the ones you want to change, for example to translate it. |
| accept | string | Accepted types, same format as the `accept` attribute, for example "image/*,.pdf". |
| multiple | boolean | |
| maxSizeMb | number | Maximum size of each file in megabytes. Bigger files are rejected with an error message. |
| label | string | |
| hint | string | |
| disabled | boolean | |
| onChange | (files: File[]) => void | Called with the accepted files every time the list changes. |