API Reference
UploadDropzone

UploadDropzone

A simple button that opens the native file picker and uploads the selected files.

Live demo

The button is shown below, try it out!


Example source code

Props

PropRequiredTypeDescription
uploadUrlYesstring | (() => Promise<string>)Either the absolute upload URL or an async function that generates it
fileTypesNoAcceptAn object of with a common MIME type (opens in a new tab) as keys and an array of file extensions as values (similar to showOpenFilePicker (opens in a new tab)'s types accept option)
multipleNobooleanWhether the user can select multiple files to upload. Defaults to false
uploadImmediatelyNobooleanWhether the upload should start right after the user drags the file in. Defaults to false
onUploadProgressNo(progress: number) => voidCalled every time the combined upload progresses by at least 10 percent. progress % is a multiple of 10.
onUploadBeginNo(fileName: string) => voidCalled at the start of each upload.
onUploadCompleteNo(uploaded: UploadFileResponse[]) => Promise<void> | voidCalled when all the files have been uploaded.
onUploadErrorNo(error: unknown) => voidCalled if there was an error at any point in the upload process.
subtitleNostringText, if provided, is shown below the "Choose files" line
contentNo(state: UploadDropzoneState) => stringReplaces all of the content shown in the dropzone. progress % is a multiple of 10 if the upload is in progress or null.
classNameNo(state: UploadDropzoneState) => stringReplaces the className of the dropzone. progress % is a multiple of 10 if the upload is in progress or null.