react-dropzone is an npm package that provides a React hook and wrapper to build HTML5-compliant drag-and-drop file selection with validation and custom markup.
Overview
react-dropzone helps React applications accept files via drag-and-drop or file dialog. It ships as ESM and CommonJS with TypeScript types and works with modern bundlers such as Vite, webpack, and Rspack. React 18 or above is required because the API is hook-based.
useDropzone exposes getRootProps and getInputProps, accept rules, size validators, drag events, paste-to-upload, removeFile and clearFiles helpers, and optional File System Access API support. It does not upload files over HTTP; consumers handle reads with FileReader or their own upload logic.
Documentation covers edge cases such as Tauri webviews (native drag-drop intercept), label elements that double-open dialogs, Safari transient activation with open(), and Android photo picker behavior. An optional integration example references Pintura Image Editor for client-side image editing after selection.
Key features
- useDropzone React hook
- Drag-and-drop and file dialog
- Accept and size validation
- Paste files from clipboard
- removeFile and clearFiles helpers
- Optional File System Access API
- TypeScript types included
- Folder and multi-file selection
Use cases
- File upload UI in React apps
- Drag-and-drop forms
- Client-side file validation
- Screenshot paste into dropzone
- Custom-styled file pickers