Uplofile is open sourceStar on GitHub

Dropzone

A drag-and-drop zone for file uploads with visual feedback.

Usage

1import {
2 UplofileRoot,
3 UplofileDropzone,
4 UplofileTrigger,
5 UplofilePreview,
6} from "@/components/ui/uplofile";
7
8export default function DropzoneDemo() {
9 return (
10 <UplofileRoot upload={async () => ({ url: "" })}>
11 <UplofileDropzone className="border-2 border-dashed p-8 rounded-lg transition-colors data-[dragging=true]:border-primary data-[dragging=true]:bg-primary/5">
12 <span>Drop files here or </span>
13 <UplofileTrigger className="underline text-blue-500">
14 click to browse
15 </UplofileTrigger>
16 <UplofilePreview />
17 </UplofileDropzone>
18 </UplofileRoot>
19 );
20}

Props

PropTypeDescription
classNamestringUse data attributes like data-dragging for styling
asChildbooleanMerge props onto the child element
...restHTMLAttributesSupports all standard HTML attributes