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

@greatnonprofits-nfp/react-images-upload

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@greatnonprofits-nfp/react-images-upload

Simple component for upload and validate (client side) images with preview built with React.js. This package use [react-flip-move](https://github.com/joshwcomeau/react-flip-move) for animate the file preview images.

  • 1.2.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
2
Weekly downloads
 
Created
Source

Images uploader UI component

Simple component for upload and validate (client side) images with preview built with React.js. This package use react-flip-move for animate the file preview images.

Installation

npm install --save react-images-upload

Usage

import React from 'react';
import ImageUploader from 'react-images-upload';

class App extends React.Component {

	constructor(props) {
		super(props);
		 this.state = { pictures: [] };
		 this.onDrop = this.onDrop.bind(this);
	}

	onDrop(picture) {
		this.setState({
            pictures: this.state.pictures.concat(picture),
        });
	}

    render() {
        return (
            <ImageUploader
				withIcon={true}
				buttonText='Choose images'
				onChange={this.onDrop}
				imgExtension={['.jpg', '.gif', '.png', '.gif']}
				maxFileSize={5242880}
			/>
        );
    }
}

Available Options

parametertypedefaultdescription
classNameString-Class name for the input.
fileContainerStyleObject-Inline styles for the file container.
onChangeFunction-On change handler for the input.
buttonClassNameString-Class name for upload button.
buttonStylesObject-Inline styles for upload button.
withPreviewBooleantrueShow preview of selected images.
acceptString"accept=image/*"Accept attribute for file input.
nameString-Input name.
withIconBooleantrueIf true, show upload icon on top
buttonTextString'Choose images'The text that display in the button.
withLabelBooleantrueShow instruction label
labelString'Max file size: 5mb, accepted: jpggif
labelStylesObject-Inline styles for the label.
labelClassstring-Class name for the label
imgExtensionArray['.jpg', '.gif', '.png', '.gif']Supported image extension (will use in the image validation).
maxFileSizeNumber5242880Max image size.
fileSizeErrorString" file size is too big"Label for file size error message.
fileTypeErrorString" is not supported file extension"Label for file extension error message.
errorClassString-Class for error messages
errorStyleObject-Inline styles for errors
singleImageBooleanfalseIf true, only a single image can be selected

License

MIT

Keywords

FAQs

Package last updated on 24 Aug 2020

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