Skip to content

adred/selfmade-react-dropzone

 
 

Repository files navigation

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

About

Simple HTML5 drag-drop zone with React.js.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 93.8%
  • TypeScript 6.2%