GitHub
Core
Glass
Brutal
Humanist

File Upload

File upload components provide a complete upload experience with drag-and-drop support and progress tracking.

File Upload Playground

File Upload Playground
Preview
Code
Upload Documents
PDF, PNG, or JPG up to 10 MB
Controls
Sample Link:
Multiple:
Disabled:

Installation

You can add the file upload component to your project manually:

1

Install the following dependencies:

npm install class-variance-authority clsx tailwind-merge @phosphor-icons/react @react-aria/focus @react-aria/interactions @react-aria/progress
2

Copy and paste the following code into your project.

Loading source code...
3

Update the import paths to match your project setup.

Update the import aliases (e.g. @/components, @/utils) in the copied files to match your project's path configuration.

Basic Usage

import { FileUploadArea } from '@versaui/ui/components/FileUpload';
import { FileUploadProgress } from '@versaui/ui/components/FileUpload';
// Upload area
<FileUploadArea
  title="Upload your documents"
  description="PDF format, maximum 10 MB"
  onFilesSelected={(files) => handleUpload(files)}
/>
// Progress indicator
<FileUploadProgress
  fileName="document.pdf"
  fileSize={1048576}
  fileType="application/pdf"
  onComplete={() => showSuccess()}
  onCancel={() => cancelUpload()}
/>

Accessibility

  • Drag-and-drop area is keyboard accessible via the Browse button
  • Upload progress announced via aria-live region
  • File input uses proper labeling for screen readers

FileUploadArea Props

PropTypeDefaultDescription
titlestring'Drag and drop a file here'Heading text in the drop zone.
descriptionstring'File type must be PDF, PNG or JPG under 5 MB'Subtext describing accepted files.
browseButtonTextstring'Browse Files'Browse button label.
acceptstringAccepted MIME types (e.g. "image/png").
multiplebooleanfalseAllow multiple file selection.
onFilesSelected(files: FileList) => voidCallback when files are selected.

FileUploadProgress Props

PropTypeDefaultDescription
fileNamestringName of the file being uploaded.
fileSizenumberFile size in bytes.
fileTypestringMIME type of the file.
initialStatus'uploading' | 'uploaded' | 'failed''uploading'Initial upload status.
errorMessagestring'Upload Failed'Error message on failure.
onComplete() => voidCallback when upload completes.
onRetry() => voidCallback to retry failed upload.

On this page