1.0.4 • Published 10 months ago

react-image-easy-upload v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

react-image-easy-upload

Upload images with react hassle free, user can just click on the image placeholder to upload the image and then change the uploaded image by just clicking on it again.

NPM JavaScript Style Guide

Visit here to see a Demo

Install

npm install --save react-image-easy-upload

Usage

import ImageUpload from "react-image-easy-upload"

function form() {
  const [uploadedImage,setUploadedImage] = useState(null)
  render() {
    return <ImageUpload setImage={setUploadedImage}/> // the file will be updated to uploadedImage state
  }
}
Attributestypevaluesdescription
setImagesetStatee.g, setImage={setUploadedImage}Provide the setState parameter to update the state of file uploaded currently, which can be validated upon form submission
shapestringcircle | square (default = square)Shape of the image being uploaded
widthstring (px or %)cssWidth (default = 100%)Width of the image div
heightstring (px or %)cssWidth (default = 100%)Height of the image div
borderbooleantrue | false (default = false)Give 2px border to the image
borderColorstringcssColor (default = none)Give color to the border of image
fallbackImagestringlink to image (default = placeholder Image)Placeholder image to load in case the image uploaded by the user is invalid

License

MIT © NeerajSati

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago