selfmade-react-dropzone
TypeScript icon, indicating that this package has built-in type declarations

0.3.8 • Public • Published

selfmade-react-dropzone

Simple React hook to create a HTML5-compliant drag'n'drop zone for files with support for auto-upload. This is based on react-dropzone

Demo

Demo

Installation

npm install --save selfmade-react-dropzone

or:

yarn add selfmade-react-dropzone

Usage

Please refer to react-dropzone for most of the functionality it offers.

For auto-uploading files, you need to pass uploadConfig prop. To monitor the progress, you can access the files with status through uploadedFiles state.

const {
  acceptedFiles,
  uploadedFiles,
  draggedFiles,
  getRootProps,
  getInputProps
} = useDropzone({
  uploadConfig: {
    url: "https://httpbin.org/post", // required
    metadata: {}, // optional
    headers: {}, // optional
    withCredentials: true, // optional
    responseType: "json" // optional
  }
});

License

MIT

Package Sidebar

Install

npm i selfmade-react-dropzone

Weekly Downloads

19

Version

0.3.8

License

MIT

Unpacked Size

689 kB

Total Files

49

Last publish

Collaborators

  • adred