FileUpload

The FileUpload component allows users to upload files with validation options such as size, type, and progress feedback.

Usage

Default

<FileUpload label="Upload your document" onSubmit={...}/>

Props

Data table
TypeDescription
allowedFileTypesstring[]Allowed file MIME types or file extensions (e.g. ".pdf", "image/png").
controlRoundingRoundingTypeRounding of the control button ('none' | 'small' | 'medium' | 'large' | 'full').
controlShadowShadowTypeShadow of the control button ('none' | 'light' | 'medium' | 'strong' | 'intense').
data-testidstringOptional test ID for testing frameworks.
descriptionstringOptional description text under the label.
disabledbooleanWhether to disable the file input.
dropzoneDescriptionstringOptional custom instructions for drag-and-drop users and assistive tech.
dropzoneRole"button" | "group" | "region"Whether the dropzone should expose a button-like role.
enableDragAndDropbooleanWhether drag and drop is enabled.
errorstringOptional error message.
failureMessagestringStatus message announced when upload fails.
fileListAriaLabelstringAccessible label for the selected files list.
fileRemovedMessage((fileName: string, index: number) => string)Message announced when a file is removed.
filesSelectedMessage((files: File[]) => string)Message announced when files are selected.
idstringOptional custom id for the root/input relationship.
inputAriaLabelstringAccessible label for the hidden native file input when no visible label is used.
labelstringLabel displayed above the file input.
liveRegionPoliteness"off" | "polite" | "assertive"Live region politeness for status updates.
maxFileSizeBytesnumberMaximum file size in bytes (e.g., 5MB = 5 * 1024 * 1024).
multiplebooleanAllows multiple file selection if true.
onFilesChange((files: File[]) => void)Called whenever selected files change.
onSubmit(files: File[]) => void | Promise<void>Called after upload completes.
outlinebooleanWhether to display the control button as an outline.
outlineRoundingRoundingTypeRounding of the wrapping element ('none' | 'small' | 'medium' | 'large' | 'full').
outlineShadowShadowTypeShadow of the wrapping element ('none' | 'light' | 'medium' | 'strong' | 'intense').
rejectedFilesAriaLabelstringAccessible label for the rejected files list.
rejectedFilesMessage((files: { name: string; reason: string; }[]) => string)Message announced when rejected files are detected.
removeFileAriaLabel((fileName: string, index: number) => string)Accessible label template for remove buttons.
requiredbooleanWhether the file input is required.
selectButtonAriaLabelstringAccessible label for the upload trigger button.
stateStateTypeThe state of the file upload ('success' | 'error' | 'warning' | 'disabled' | '').
successMessagestringStatus message announced when upload succeeds.
themeThemeTypeTheme for the buttons and progress bar ('primary' | 'secondary' | 'tertiary' | 'quaternary' | 'clear').
uploadButtonAriaLabelstringAccessible label for the submit/upload button.
uploadProgressnumberExternal upload progress value (overrides internal simulation).