Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-image-upload

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-image-upload

react library for uploading images

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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={
    <img
      src='https://img.icons8.com/ios-glyphs/30/000000/delete-sign.png'
      alt=''
    />
  }
  uploadIcon={
    <svg
      className='svg-circleplus'
      viewBox='0 0 100 100'
      style={{ height: '40px', stroke: '#000' }}
    >
      <circle cx='50' cy='50' r='45' fill='none' strokeWidth='7.5'></circle>
      <line x1='32.5' y1='50' x2='67.5' y2='50' strokeWidth='5'></line>
      <line x1='50' y1='32.5' x2='50' y2='67.5' strokeWidth='5'></line>
    </svg>
  }
/>

Props

PropertyTypeDefaultDescription
styleobjoptionalstyle the file with css
deleteIconfuncoptionaladds your delete icon or html element
uploadIconfuncoptionaladds your upload icon or html element
onFileAddedfuncoptionalruns after file has been selected and returns the selected file
onFileRemovedfuncoptionalruns after file has been removed and returns the removed file

License

MIT © chimdie

Keywords

FAQs

Package last updated on 24 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc