Skip to main content

FileUpload

A file upload component with drag-and-drop support, file validation, and preview functionality.

Area Variant

Drag and drop files here, or browse

Inline Variant

Drop files here or browse

Sizes

Drag and drop files here, or browse
Drag and drop files here, or browse
Drag and drop files here, or browse

Disabled

Drag and drop files here, or browse

Mobile considerations

  • On touch devices, tap-to-browse is the primary interaction — drag-and-drop hover styles still apply for desktop browsers that report pointer: fine.
  • accept="image/*" triggers the OS image picker (camera roll, files app, or live camera on iOS / Android).
  • accept="image/*" + capture="environment" (passed via standard HTML attribute) opens the rear camera directly — useful for receipt / document capture flows.
  • The dropzone meets a 44px tap target at all sizes; variant="inline" is preferred for compact mobile forms.

With Restrictions

<FileUpload
accept="image/*,.pdf"
multiple
maxFiles={5}
maxFileSize={10 * 1024 * 1024}
onFilesChange={(files) => console.log(files)}
onValidationError={(errors) => console.error(errors)}
/>

Props

PropTypeDefaultDescription
acceptstring-Accepted file types (e.g. "image/*,.pdf")
multiplebooleanfalseAllow multiple file selection
maxFilesnumber-Maximum number of files allowed
maxFileSizenumber-Maximum file size in bytes
fileListFileUploadFile[]-List of uploaded files to display
disabledbooleanfalseDisabled state
onFilesChange(files: File[]) => void-Callback when valid files are added
onRemove(file: FileUploadFile) => void-Callback when a file is removed
onValidationError(errors: ValidationError[]) => void-Callback when validation errors occur
variant'area' | 'inline''area'Visual variant
listType'list' | 'grid''list'File list display type
size'sm' | 'md' | 'lg''md'Size of the dropzone
placeholderstring-Custom placeholder text
browseTextstring'browse'Text for the browse link
renderPreview(file: FileUploadFile) => ReactNode-Custom preview renderer for grid items
classNamestring-Additional CSS class
styleCSSProperties-Inline styles