1.0.4 • Published 5 years ago

react-dndf v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

react-dndf

Simple React component package for drag and drop files

Installation

npm install --save react-dndf // for npm
yarn add react-dndf // for yarn

Example

const React = require("react")

const reactDNDF = require("react-dndf") const DropZone = reactDNDF(React) class App extends React.Component{

fileChangeHandler = (files) => {
	// Handling selected files
	console.log("files : ", files)
}

render(){
	return (
		<div>
			<DropZone onFileChange={this.fileChangeHandler}>
				<div style={{ width : "100%", height : "100%", backgroundColor : "gray" }}> 
					Drag And Drop files Here !
				</div>
			</DropZone>		
		</div>
	)
}

}

# Usage
```javascript
			// img cover
			<DropZone onFileChange={this.fileChangeHandler}>
				<img 
					style={{ width : "100%", height : "100%" }} 
					src={yourImgSrc}
				/>
			</DropZone>		
			
			// div cover
			<DropZone onFileChange={this.fileChangeHandler}>
				<div className="myCoverClassName">{yourText}</div>
			</DropZone>		
			

Props

NameTypeargumentsDescription
onFileChangecallback funcfilesCallback fired when a file is dragged and dropped
accepttextHTML input tag accept Attribute
wrapperClassNametextclassName for DropZone wrapper
wrapperStyleobjectinline style for DropZone wrapper

Contributing

Contributions, questions and pull requests are all welcomed.

License

Copyright (c) 2019. Bpeak Licensed with The MIT License (MIT)

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago