Socket
Socket
Sign inDemoInstall

react-img-prev

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-img-prev

A react image picker with preview


Version published
Weekly downloads
3
Maintainers
1
Install size
22.6 kB
Created
Weekly downloads
 

Readme

Source

react-img-prev

A react image picker with preview

It let you pick files from your computer and display only the first one.

Install :

npm install react-img-prev

How to use it :

import ReactImgPrev from "react-img-prev";

const Component = () => {

  const [files, setFiles] = useState({});

  return (
    <ReactImgPrev files={files.files} setFiles={setFiles} />
  )}

If you want to display your own placeholder in place of the default icon, you can pass it as a children.

import ReactImgPrev from "react-img-prev";

const Component = () => {

  const [files, setFiles] = useState({});

  return (
    <ReactImgPrev files={files.files} setFiles={setFiles} >
      <h1>Image</h1>
    </ReactImgPrev>
  )}

You can pass additional options.

Accepted props :

PropsTypeOptional ?Description
widthNumberyeswidth of the display preview
heightNumberyesheight of the display preview
classNamestringyesclass of the preview
acceptstringyestype accepted for input
maxstringyesmax number of file
filesFilenofiles selected
setFilesFunctionnoset selected files

License

Under the MIT license.

FAQs

Last updated on 29 Apr 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc