Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hjxenjoy/drag-and-paste

select files with drag and drop or paste
https://github.com/hjxenjoy/drag-and-paste

Last synced: 10 days ago
JSON representation

select files with drag and drop or paste

Awesome Lists containing this project

README

        

# drag-and-paste

> Made with create-react-library

[![NPM](https://img.shields.io/npm/v/drag-and-paste.svg)](https://www.npmjs.com/package/drag-and-paste) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save drag-and-paste
```

## Usage

```tsx
import React from 'react'

import useUpload from 'drag-and-paste'

import './index.css'

export default function App() {
const [boxRef, files] = useUpload()
const [dragFocused, setDragFocused] = React.useState(false)

React.useEffect(() => {
console.log('New Files', files)
}, [files])

return (

setDragFocused(true)}
onDragLeave={() => setDragFocused(false)}
onMouseLeave={() => dragFocused && setDragFocused(false)}
>
Drop Or Paste Here.


Open DevTools Console


paste only support image

)
}
```

## License

MIT © [hjxenjoy](https://github.com/hjxenjoy)