File Dropzone

Drag-and-drop file area with ripples, type and size checks, and a file list.

no dependenciesMIT · free

Installation

npx shadcn@latest add https://ombakui.com/r/file-dropzone.json

Usage

import { FileDropzone } from "@/components/file-dropzone";

<FileDropzone accept="image/*,.pdf" maxSize={5 * 1024 * 1024} onFiles={upload} />

Props

PropTypeDefaultDescription
onFiles(files: File[]) => void–Called with the accepted files each time files are added.
acceptstring–Accepted types, like the input's accept attribute, e.g. "image/*,.pdf".
multiplebooleantrueAllow several files.
maxSizenumber–Maximum size per file in bytes. Larger files are rejected with a message.
promptstring"Drop files here or click to browse"Main prompt.
classNamestring–