Library / SDK
react-dropzone/react-dropzone avatar
react-dropzone/react-dropzone

react-dropzone hands you two prop getters and one input element

Simple HTML5 drag-drop zone with React.js.

11,026 stars799 forksTypeScriptMIT

At a glance

What is it?
react-dropzone is a TypeScript React hook for building HTML5 file drop zones, published from npm as ESM and CommonJS with types included. Its contract is small: a root getter for any element, an input getter that must land on an input, and a File list that stops at the browser's File objects. Everything after that, bytes, progress and retries is your code.
Who is it for?
Use react-dropzone when you want one drop target that behaves like a native file input and stays out of your component tree, especially when you are already shipping React with TypeScript and a modern bundler. Skip it if you need upload progress, chunking, retries or image previews out of the box, because the hook ends at the File list and the repository says so plainly when it points you at the FileReader API.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly TypeScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • react-dropzone/react-dropzone11,026 ★ · +13
Star history
Repository2026-09-222026-11-22
react-dropzone/react-dropzone11k11k

13 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The version in the repository is 0.0.0-development while the published line sits at 20.x

Open package.json in a fresh checkout and the version field reads 0.0.0-development, not 20.1.4. The published records tell a different story: v20.1.2 on 2026-09-14, v20.1.3 on 2026-10-10, and v20.1.4 on 2026-10-17, with the master branch pushed on 2026-11-01. A .releaserc.json at the root is what fills the real number in at publish time, so the placeholder is by design rather than an oversight. Consequence for anyone downstream: a vendored copy, a fork, or an internal mirror carries 0.0.0-development into every lock file, cache, and license report that reads the version, so the string you read in a fork tells you nothing about which release you are actually running. Record the published tag yourself if you need provenance.

The tarball ships src/ next to dist/, and resolution depends on which field your bundler honors

The files array lists dist, then src, then an exclusion pattern that drops spec files from src, so a consumer installs the build output and the raw TypeScript together. Entry points are declared twice over: main points at ./dist/index.cjs, module at ./dist/index.js, types at ./dist/index.d.ts, and an exports map repeats those three under the . key with import and require conditions plus a ./package.json entry. The package is marked type module and sideEffects false, which is the signal that lets a bundler drop an unused import. Consequence: which file your app actually loads depends on whether your tooling reads main, module, or exports, the spec exclusion only applies under npm-aware tooling, and every install carries both the bundle and the sources.

Props set on the element can win over the ones getRootProps() returns, so pass them in

The root properties can be applied to whatever element you choose, while the input properties must land on an input element. The instruction that matters is the merge order: any extra prop you want on that element should be passed through getRootProps() rather than written on the element after the spread.

jsx
<div
  {...getRootProps({
    onClick: event => console.log(event),
    role: "button",
    "aria-label": "drag and drop area"
    // ...and any other props
  })}
/>

The reason given is to avoid your props being overridden by, or overriding, the ones the getter returns. Because your onClick runs before the internal handler, calling stopPropagation cancels the built in behavior, which is the documented escape hatch and also the easiest way to break click to open by accident.

Render the input for the default file dialog and fallback

In the default input-based mode, omitting the input or failing to bind getInputProps() prevents the file dialog from opening. With useFsAccessApi enabled in a secure context and a supported browser, the hook can instead use showOpenFilePicker. Still render the input for fallback when that API is unavailable or blocked. The smallest working surface is therefore three lines: a root element, an input, and the two getters, which is exactly what the minimal example renders.

jsx
import React from "react";
import {useDropzone} from "react-dropzone";

function MyDropzone() {
  const {getRootProps, getInputProps} = useDropzone();

  return (
    <div {...getRootProps()}>
      <input {...getInputProps()} />
      <p>Drag 'n' drop some files here, or click to select files</p>
    </div>
  );
}

The hook also returns isDragActive, which is what drives the drag over message in the fuller example. In the default mode, an accessibility wrapper, custom trigger button, or test double that renders only the root cannot open the file dialog. The input also provides the fallback for the File System Access picker.

refKey is the escape hatch, and both documented workarounds are pinned to old library majors

Both getters accept a custom refKey, defaulting to ref, passed down as an attribute. It exists for elements that do not expose a reference to the DOM node. Two recipes are given. One wraps a styled-components element with refKey: "innerRef", carrying a note that after v4.0.0 styled-components exposes a ref through forwardRef, so innerRef is no longer needed. The other targets Material UI v4 specifically, importing RootRef from @material-ui/core/RootRef and splitting the getter with a destructure, const {ref, ...rootProps} = getRootProps(). Consequence: if your component library neither forwards refs nor ships a RootRef equivalent, there is no documented route. The file also warns against setting the ref prop on the elements yourself and instead takes rootRef and inputRef from the hook.

You get File objects and nothing more, so bytes, progress and failure handling are yours

The library stops at the file list. To reach contents the documentation sends you to the browser's FileReader API, and the example wires three handlers of your own: onabort logging that reading was aborted, onerror logging that reading has failed, and onload receiving the result, then calls reader.readAsArrayBuffer(file) per file. The README example shows no progress reporting, retrying, uploading or chunked reading. The documented approach also pulls each file fully into memory as an ArrayBuffer. Consequence for a reader: a multi gigabyte upload widget built on this is your code to write and your memory ceiling to own, and the abort path matters because a user who navigates away mid read is your responsibility, not the library's.

prepare is prek install or exit 0, so a broken hook install passes silently

The scripts section shows how much of the toolchain is not what you would guess. The build is tsdown, with dev running the same in watch mode and a prebuild that runs clean, which is a raw rm -rf dist. Linting is oxlint, with a separate type aware mode, formatting is oxfmt with a check mode, and type-check runs tsc --noEmit twice, once for the project and once against tsconfig.type-tests.json. The coverage script chains type check, lint and format together. Hooks are installed by prek, and the prepare script runs prek install followed by or exit 0. Consequence: when prek is missing or fails, installation still succeeds, so you can commit without the checks the project relies on and find out only in review.

Two agent instruction files, three tsconfigs, and no single order of operations

The root carries AGENTS.md and CLAUDE.md side by side, plus .codeclimate.yml, .editorconfig, .oxfmtrc.json, .oxlintrc.json, .pre-commit-config.yaml, .npmrc and .nvmrc. Types are split three ways: tsconfig.json, tsconfig.build.json and tsconfig.type-tests.json, with a type-tests/ directory feeding the second tsc pass. Tests come in two shapes, a unit setup with test-setup.js and vitest.config.ts, and a browser layer with playwright.config.ts and an e2e/ directory. Documentation is its own site, with vocs.config.ts, netlify.toml, docs/ and public/. Consequence: contributors and automated agents have two instruction files and several scripts to piece together.

Editorial conclusion

Use react-dropzone when you want one drop target that behaves like a native file input and stays out of your component tree, especially when you are already shipping React with TypeScript and a modern bundler. Skip it if you need upload progress, chunking, retries or image previews out of the box, because the hook ends at the File list and the repository says so plainly when it points you at the FileReader API. Before you adopt it, read the two rules that cause most bugs: pass every prop through getRootProps() instead of setting it on the element, and always render the input, because without it the file dialog cannot open. Then check that your component library forwards refs, or find out now what refKey you will need.

Frequently asked questions

What is dropzone in react?

react-dropzone is a simple React hook for creating an HTML5 compliant drag and drop zone for files. The hook is called with an onDrop callback and returns getRootProps, getInputProps and isDragActive, and there is also a wrapper component whose children are a function receiving the same getters.

How to install Dropzone?

From npm with npm install react-dropzone, or with yarn add react-dropzone. It ships as ESM and CommonJS with TypeScript types included, and the documentation states it works with any modern bundler, naming Vite, webpack and Rspack.

how to use react dropzone

Call useDropzone({onDrop}), spread getRootProps() onto any element you want to be the drop target, and spread getInputProps() onto an input. If you omit the input or leave getInputProps unbound, opening a file dialog will not be possible. To read file contents you add the browser FileReader API yourself.

react dropzone vs uppy

The README's installation and usage sections make no comparison with Uppy, FilePond or react dnd. What it states about itself is narrow: a hook returning two prop getters and a drag active flag, file contents read through the FileReader API, and a component wrapper whose ref exposes an open method for opening the file dialog programmatically.

Official sources

  1. License: MIT
  2. Project website
  3. react-dropzone/react-dropzone on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/react-dropzone-react-dropzone.svg)](https://hysenlabs.com/projects/react-dropzone-react-dropzone)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/react-dropzone-react-dropzone.svg)](https://hysenlabs.com/projects/react-dropzone-react-dropzone)

Was this useful?