file-drops

0.5.0 • Public • Published

file-drops

A simple in-browser file drop utility.

Usage

import fileDrop from 'file-drops';

const element = document.querySelector('#container');

const dropHandler = fileDrop('Drop a file', function(files) {
  // files = [ { name, contents }, ... ]
});

element.addEventListener('dragover', dropHandler);

Styling

On drop over, the utility will attach the following overlay to the element for which the drop handler got registered:

<div class="drop-overlay">
  <div class="box">
    <div class="label">{label}</div>
  </div>
</div>

Style it as you wish. ❤️

See also

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i file-drops

Weekly Downloads

4,083

Version

0.5.0

License

MIT

Unpacked Size

66.1 kB

Total Files

9

Last publish

Collaborators

  • nikku