Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/hjxenjoy/drag-and-paste
- Owner: hjxenjoy
- Created: 2020-05-08T05:44:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T02:16:33.000Z (7 months ago)
- Last Synced: 2024-04-23T05:57:39.952Z (7 months ago)
- Language: TypeScript
- Homepage: https://hjxenjoy.github.io/drag-and-paste
- Size: 717 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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)