A React component to compare images with a slider.
npm install react-image-comparison-slider
`
or
`
yarn add react-image-comparison-slider
`
Usage
`
import ImageSlider from "react-image-comparison-slider";
image1=""
image2=""
onSlide={() => {
console.log("sliding");
}}
/>
`
Props
| Props | Type | Default | Description |
| --------------------- | :---------: | :-------: | --------------------------------------------------------- |
| image1 | string | - | First image's source (URL, base64 string etc.) |
| image2 | string | - | Second image's source (URL, base64 string etc.) |
| alt1 | string | "alt1" | First image's alt text |
| alt2 | string | "alt2" | Second image's alt text |
| sliderColor | string | "red" | Slider's color. Should be valid CSS color expression. |
| sliderWidth | number | 3 | Slider's width in pixel. |
| showHandle | boolean | true | If false, hides slider handle. |
| handleBackgroundColor | string | "white" | Background color of the slider's handle. |
| handleColor | string | "red"` | Background color of the triangles on the slider's handle. |