New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

image-comparison-slider-react

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

image-comparison-slider-react

Image comparison slider component for React.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

Image Comparison Slider

GitHub Repo stars npm

Image comparison slider component for React.

Demo Image

View This Demo  →

Download

NPM:

npm install image-comparison-slider-react

Yarn:

yarn add image-comparison-slider-react

Usage

<ImageComparisonSlider
  images={[
    {
      src: './image1.jpg',
      alt: 'First Image',
    },
    {
      src: './image2.jpg',
      alt: 'Second Image',
    },
  ]}
></ImageComparisonSlider>

Add Descriptive Text For Each Image

As seen in the example image at the beginning of this README, describe descriptive text can be added for each image. This can be done by adding the text property to each image object like so:

<ImageComparisonSlider
  images={[
    {
      src: './image1.jpg',
      alt: 'First Image',
      text: 'Before',
    },
    {
      src: './image2.jpg',
      alt: 'Second Image',
      text: 'After',
    },
  ]}
></ImageComparisonSlider>

Options

Additional options can be added via the options prop. Here's a list of possible options:

  • color — color of the slider (default is #2188ff)
  • iconColor — color of the slider icon (default is #fff)
  • height — height of the image (default is 18.75rem)
  • width — width of the image (default is 30rem),

Here's an example component with options:

<ImageComparisonSlider
  images={[
    {
      src: './image1.jpg',
      alt: 'First Image',
      text: 'Before',
    },
    {
      src: './image2.jpg',
      alt: 'Second Image',
      text: 'After',
    },
  ]}
  options={{
    color: 'yellow',
    iconColor: '#000',
    height: '250px',
    width: '350px',
  }}
></ImageComparisonSlider>

License

Image Comparison Slider is MIT Licensed.

Keywords

FAQs

Package last updated on 08 Apr 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