Skip to content
pandacoderz/ui

File Drop

Drag-and-drop upload zone with an attachment list that shows progress, size, and errors.

Drop files here or click to browsePDF, CSV, MD, PNG
  • q3-report.pdf1.2 MB
  • customers.csv80 KB

Installation

npx shadcn@latest add https://ui.spencerwueste.com/r/file-drop.json

Usage

import { FileDrop, FileItem, FileList, type DroppedFile } from "@/components/pandacoderz-ui/file-drop";
<FileDrop onFiles={upload} accept=".pdf,.md" />
<FileList>
  {files.map((f) => <FileItem key={f.id} file={f} onRemove={remove} />)}
</FileList>

FileDrop hands you raw File objects. Map them into DroppedFile records and update progress as your upload proceeds; the item shows a bar until it reaches 100.

API Reference

FileDrop

Prop Type Description
onFiles (files: File[]) => void Called on drop or pick.
accept string Native accept string; also shown as hint text.
multiple boolean Default true.
compact boolean Single-line variant.

FileItem

Prop Type Description
file DroppedFile { id, name, size, type, progress?, error? }.
onRemove (id) => void Shows a remove button.
selected boolean Highlighted state.