Upload

A file upload component with drag and drop support and progress indication.

Preview

Usage

import { FileUpload } from "@/components/docs/Uploading"

export default function App() {
  const handleFilesSelected = (files: File[]) => {
    console.log("Files selected:", files)
  }

  const handleUpload = async (files: File[]) => {
    console.log("Uploading files:", files)
  }

  return (
    <FileUpload
      onFilesSelected={handleFilesSelected}
      onUpload={handleUpload}
      acceptedFormats="image/jpeg,image/png,image/svg+xml"
      maxFileSize={5 * 1024 * 1024}
    />
  )
}

API Surface

PropTypeDefaultDescription
onFilesSelected(files: File[]) => voidCallback when files are selected or dropped.
onUpload(files: File[]) => Promise<void>Async callback for handling the upload process.
maxFileSizenumber5MBMaximum allowed file size in bytes.
acceptedFormatsstring[] | stringImagesComma-separated string or array of accepted MIME types.
multiplebooleantrueWhether to allow multiple file selection.
showProgressbooleantrueWhether to show the progress bar.
onUploadSuccess() => voidCallback when upload completes successfully.