Loading...
Loading...
> Drag-and-drop file upload zone with visual feedback. Supports click-to-upload and keyboard navigation. Fully accessible.
1import { Dropzone } from "@/components/ui/file-upload/dropzone";
Drag and drop files here, or click to select
Supports any file type
1const [files, setFiles] = useState<File[]>([]);23<Dropzone onFilesDropped={setFiles}>4 <div className="flex flex-col items-center gap-2">5 <Upload className="size-8 text-muted-foreground" />6 <p className="text-sm font-mono">7 Drag and drop files here, or click to select8 </p>9 <p className="text-xs text-muted-foreground font-mono">10 Supports any file type11 </p>12 </div>13</Dropzone>1415{files.length > 0 && (16 <div className="border rounded-none p-4 space-y-2">17 <p className="text-xs font-semibold">[SELECTED FILES]:</p>18 {files.map((file, i) => (19 <div key={i} className="flex items-center gap-2 text-xs">20 <FileText className="size-4" />21 <span>{file.name}</span>22 <span className="text-muted-foreground">23 ({(file.size / 1024).toFixed(1)} KB)24 </span>25 </div>26 ))}27 </div>28)}
Drop images here
1<Dropzone onFilesDropped={setFiles} className="aspect-video">2 <div className="flex flex-col items-center justify-center h-full gap-2">3 <ImageIcon className="size-10 text-muted-foreground" />4 <p className="text-sm font-mono">Drop images here</p>5 {files.length > 0 && (6 <p className="text-xs text-primary font-mono">7 {files.length} image(s) selected8 </p>9 )}10 </div>11</Dropzone>
1<Dropzone className="py-4">2 <div className="flex items-center justify-center gap-2">3 <File className="size-4 text-muted-foreground" />4 <span className="text-xs font-mono">Click or drop to upload</span>5 </div>6</Dropzone>
Visual feedback when dragging files over the zone. Border and background change to indicate drop target.
Click anywhere in the zone to open the native file picker. Supports multiple file selection.
Full keyboard support with Enter and Space to activate. Focus states visible for navigation.
Pass any children for custom content. Style with className prop. Flexible sizing.
| Prop | Type | Description |
|---|---|---|
| onFilesDropped | (files: File[]) => void | Callback when files are selected |
| children | ReactNode | Content to display inside zone |
| className | string | Additional CSS classes |
multiple enabled by default.