Skip to content

NewMCP server for your coding agent. Set it up ›

Nexus UI
Get Pro

Upload Dropzone, animated React component

A file drop target with a list of uploads. While a file hovers, a little stack of sheets fans out over a tray and the dashed edge marches; when files land the tray squashes as it swallows them, each row fills a progress ring that turns into a drawn check, and rejected files shake the zone. Also includes Avatar Upload, a profile photo picker where you drag and zoom inside a circle and a ring draws itself around the avatar as it saves. Also includes Upload Queue, a list where each row is its own progress bar with pause, cancel and a whole-card drop target that counts the files. Also includes Empty Table: Ghost columns show the shape of the data. Drop a CSV or take the sample and a scan line reads down the table as cells fill in order, columns label their types and the count rolls up.

  • Pro
  • Inputs & Controls
  • Spring

Thumps when you drop or choose files, bumps on a rejected file and plays a done chord when an upload finishes. The Empty Table variant taps when you press Upload CSV or Use sample data and plays one soft rising chord when the row count finishes rolling up. Sound is off on this site until you switch it on.

Upload Dropzone

Avatar Upload

Upload Queue

Empty Table

Props

PropTypeDefaultWhat it does
accept—Same syntax as the input accept attribute, e.g. "image/*,.pdf".
maxSize5242880Largest file accepted, in bytes (5 MB).
multipletrueAccept several files at once.
onFiles—Called with every batch of accepted files.
onUpload—Upload one file and report progress 0-1; reject to mark it failed. Simulated when omitted.
initialFiles—Files shown on first render; unfinished ones keep uploading.
title"Drag a file here"Main line inside the zone.
hint—Secondary line. Defaults to the size limit.
accent—Tray, marching edge and drag tint colour. Defaults to system blue.
autoplayfalseDrops a few example files in by itself until someone touches it.
disabledfalseDims the zone and ignores drops and clicks.
className—Extra classes for the 340px-wide wrapper.
AvatarUpload.onUploadundefinedCalled when the simulated upload finishes, with the chosen file and framing. Nothing is sent anywhere, and src is an object URL revoked on unmount.
AvatarUpload.onRemoveundefinedCalled after the photo is removed or the crop is cancelled.
AvatarUpload.autoplayfalseRuns a demo with a drawn photo (reach, frame, zoom, save) until someone touches the card.
AvatarUpload.classNameundefinedExtra classes for the card.
UploadQueue.onFilesundefinedCalled with the files that were dropped or chosen. They are listed only; contents are never read or sent.
UploadQueue.onCompleteundefinedCalled once per row when its simulated transfer ends.
UploadQueue.onCancelundefinedCalled when a row is cancelled.
UploadQueue.autoplayfalseDrops in three sample files, pauses one and resumes it, in a loop, until someone touches the card.
UploadQueue.classNameundefinedExtra classes for the card.
EmptyTable.title"Customers"Heading of the table card.
EmptyTable.samplea small customers fileThe table Use sample data loads and the columns the ghost header shows: file, cols, kinds, rows and total.
EmptyTable.onImportundefinedCalled with the parsed table after a CSV is dropped or chosen, or the sample is loaded by hand. The file is read in the browser and never sent anywhere.
EmptyTable.autoplayfalseDrops the sample file in, shows the import, clears it and repeats until someone touches the component. Never runs under reduced motion and pauses when off screen.
EmptyTable.classNameundefinedExtra classes for the card.
enableSoundtruePlays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component.

Add it to your project

  1. 1

    Set up your project once

    You need a Next.js project with Tailwind CSS and the @/ import alias. In its root folder, run this once. It creates components.json and the cn() helper in src/lib/utils.ts:

    npx shadcn@latest init -d

    Starting from nothing? The Quick Start walks through the whole thing.

  2. 2

    Connect the registry with your API key

    Upload Dropzone is a Pro item, so the CLI has to send your API key. Do this once per project:

    1. Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with nxs_ and is shown only once.
    2. In your project root, next to package.json, create a file named .env.local with this line, using your own key:
      NEXUS_API_KEY=nxs_your_key_here
    3. Open components.json and add this entry inside the outermost braces, next to "aliases". Leave {name} and ${NEXUS_API_KEY} exactly as written; the CLI fills them in:
      "registries": {
        "@nexus-labs": {
          "url": "https://www.nexus-ui.com/api/registry/{name}",
          "headers": {
            "Authorization": "Bearer ${NEXUS_API_KEY}"
          }
        }
      }

How Upload Dropzone works

A profile photo picker that handles the whole job: drop or choose an image, drag it around inside the circle and zoom to frame it, then save. A ring draws itself around the avatar as it "uploads" and a check pops in when it's done. Dragging a file over the avatar makes it reach out for it. The upload is simulated: the photo never leaves the browser.

The source, the install command and the build prompt come with Pro.

Upload Dropzone questions

How do I install the Upload Dropzone?

Run `npx shadcn@latest add @nexus-labs/upload-dropzone`. It installs framer-motion and includes four exports: `UploadDropzone`, `AvatarUpload`, `UploadQueue` and `EmptyTable`. It is a Pro component, so it needs a Pro plan and an API key; key setup is on the CLI docs page (/docs/cli).

How do I send files to my own server?

Pass `onUpload`, a function that receives the `File` and a `setProgress` callback (0 to 1) and returns a promise; resolve it when the upload finishes or reject it to mark the row as failed. Without `onUpload` the uploads are simulated, so nothing leaves the browser.

How do I limit file types and size?

Use `accept` with the same syntax as the input attribute (for example "image/*,.pdf"), `maxSize` in bytes (default 5242880, which is 5 MB) and `multiple` (default true). Files that fail show an error such as "Over 5 MB" or "Not supported" in the list and shake the zone, while `onFiles` is called only with the accepted ones.

Does it work with the keyboard and reduced motion?

Yes. The drop zone is a focusable `role="button"` that opens the file picker on Enter or Space, each row has a remove button, and results are announced through an `aria-live` region. With reduced motion on, the sheets do not fan out, the zone does not scale or shake and the list rows only fade.

Does it make sound, and how do I turn it off?

Thumps when you drop or choose files, bumps on a rejected file and plays a done chord when an upload finishes. The Empty Table variant taps when you press Upload CSV or Use sample data and plays one soft rising chord when the row count finishes rolling up. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.

Guides