Skip to content

File Upload

Used to select files to be uploaded from the user’s device.

import { useState } from 'react';
import { FileUpload } from '@fintech-sandpit/ui/react';
const [files, setFiles] = useState<File[]>([]);
return (
<FileUpload
value={files}
onChange={setFiles}
/>
);
NameTypeDefaultDescription
valueFile[]The list of files to be uploaded
labelstringThe label of the file upload
namestringThe name of the file upload
acceptstring | string[]The accepted file types
dropZonebooleanWhether to use a drop zone
dropZoneInnerReactNodeThe content of the drop zone
multiplebooleanWhether to allow multiple files
maxFilesnumberThe maximum number of files to upload
minFileSizenumberThe minimum file size
maxFileSizenumberThe maximum file size
uploadTriggerReactNodeThe content of the upload trigger
directorybooleanWhether to allow directory uploads
disabledbooleanWhether the file upload is disabled
NameDescription
drop-zone-innerThe content of the drop zone
upload-triggerThe content of the upload trigger
NameTypeDescription
onChange(files: File[]) => voidCallback fired when the files are added or removed
onAccept(file: File) => voidCallback fired when the file is accepted
onReject(file: File, errors: FileError[]) => voidCallback fired when the file is rejected