react-image-upload
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

react-image-upload

A react library for uploading image. Demo

NPM JavaScript Style Guide

Install

npm install --save react-image-upload

Examples

import ImageUploader from 'react-image-upload'
import 'react-image-upload/dist/index.css'

const App = () => {
  function getImageFileObject(imageFile) {
    console.log({ imageFile })
  }

  function runAfterImageDelete(file) {
    console.log({ file })
  }

  return (
    <ImageUploader
      onFileAdded={(img) => getImageFileObject(img)}
      onFileRemoved={(img) => runAfterImageDelete(img)}
    />
  )
}

export default App

Adding props

<ImageUploader
  style={{ height: 200, width: 200, background: 'rgb(0 182 255)' }}
  deleteIcon={<RiDeleteRow />}
  uploadIcon={<BsCamera />}
/>

Props

Property Type Default Description
style obj optional Write your custom css
deleteIcon ele optional The icon used to delete file
uploadIcon ele optional The icon used to upload file
onFileAdded func required A function that runs after file has been uploaded and returns the uploaded file
onFileRemoved func optional A function that runs after file has been removed and returns the removed file

License

MIT © chimdie

Readme

Keywords

Package Sidebar

Install

npm i react-image-upload

Weekly Downloads

596

Version

3.0.1

License

MIT

Unpacked Size

46.1 kB

Total Files

8

Last publish

Collaborators

  • copy-ninja
  • chimdie