Upload Dropzone, animated React component
A drag-and-drop upload card that lifts and marches its dashed edge while a file hovers, then lists each file with a type badge and a progress ring.
- Free
- Inputs & Controls
- Spring
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
Drag a file hereUp to 5 MB
- PNGmood.png1.2 MB
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| accept | string | — | Same syntax as the file input accept attribute, e.g. "image/*,.pdf". |
| maxSize | number | 5242880 | Largest file accepted, in bytes. Bigger files are listed as errors and the card shakes. |
| multiple | boolean | true | Accept several files at once. |
| onFiles | (files: File[]) => void | — | Called with every batch of accepted files. |
| onUpload | (file: File, setProgress: (p: number) => void) => Promise<void> | — | Upload one file and report progress from 0 to 1. Without it, uploads are simulated. |
| initialFiles | { name: string; size: number; type?: string; progress?: number }[] | — | Files shown on first render, such as ones already uploaded. |
| title | string | "Drag a file here" | Main line of the card. |
| hint | string | — | Secondary line. Defaults to the size limit. |
| accent | string | "#6d5cff" | Tint and dashed edge colour while a file is dragged over. |
| disabled | boolean | false | Ignore drops and clicks. |
| className | string | — | Extra classes on the wrapper. |
Add it to your project
- 1
Prepare your project
You need Tailwind CSS and the
@/import alias. If shadcn isn't set up yet, initialise it once:npx shadcn@latest init
Then add the Nexus registry to your
components.json(theregistrieskey is the part that matters):{ "$schema": "https://ui.shadcn.com/schema.json", "style": "default", "rsc": true, "tsx": true, "tailwind": { "css": "src/app/globals.css", "baseColor": "neutral", "cssVariables": true, "prefix": "" }, "aliases": { "components": "@/components", "utils": "@/lib/utils", "ui": "@/components/ui", "lib": "@/lib", "hooks": "@/hooks" }, "registries": { "@nexus-labs": "https://www.nexus-ui.com/api/registry/{name}" } } - 2
Add the component
Run this from your project root. It adds the component, the utilities it uses and its packages.
npx shadcn@latest add @nexus-labs/upload-dropzone
- 3
Check what was added
With the standard aliases, these files land in your project:
components/upload-dropzone/index.tsupload-dropzone.tsx - 4
Copying by hand? Install the packages
Skip this if you used the command above.
npm install framer-motion lucide-react
- 5
Use it in a page
Import it and render it. The Code tab above has the full example.
// app/page.tsx import { UploadDropzone } from "@/components/upload-dropzone"; export default function Page() { return ( <main> <UploadDropzone /> </main> ); }