Docs
File Uploader

A component for uploading files with a preview and save functionality

Installation

pnpm dlx shadcn@latest add https://devkit.kiron.dev/k/file-uploader

Usage

import { FileUploader } from "@/components/ui/file-uploader"
 
export function Component() {
  return (
    <div className="w-full">
      <FileUploader />
    </div>
  )
}

Examples

File Upload with Dialog

File Upload with React Hook Form

Props

NameTypeDefault ValueDescription
valueFile[][]The current value of the file uploader.
onValueChange(files: File[]) => voidundefinedCallback function that is called when the value changes.
onUpload(files: File[]) => Promise<void>undefinedCallback function that is called when the files are uploaded.
progressesRecord<string, number>{}An object that maps the file name to the upload progress percentage.
acceptstring[][]An array of accepted file types.
maxSizenumberInfinityThe maximum file size in bytes.
maxFileCountnumberInfinityThe maximum number of files that can be uploaded.
multiplebooleanfalseWhether to allow multiple file uploads.
disabledbooleanfalseWhether the file uploader is disabled.