Permalink
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (19 sloc) 592 Bytes

<DropArea>

Catches file and text drop and paste events.

Usage

import {DropArea} from 'libreact/lib/DropArea';

<DropArea
  onFiles={(files, event) => console.log(files)}
  onUri={(uri, event) => console.log(uri)}
  onText={(text, event) => console.log(text)}
>
  <div style={{border: '1px solid tomato'}}>
    Drop it like a bomb!
  </div>
</DropArea>

Props

  • onFiles — called when files are dropped or pasted into the area.
  • onUri — called an URI from another tab is dropped in the area.
  • onText — called when text is paste in the area.