0.1.5 • Published 7 months ago

solid-compare-image v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Solid Compare Image

Package based on react-compare-image

  1. Installation
  2. Implementation
  3. References

Installation

# npm
npm install solid-compare-image

# yarn
yarn add solid-compare-image

Implementation

import SolidCompareImage from "solid-compare-image";

const App: Component = () => {

  return (
    <SolidCompareImage
        leftImage={...}
        rightImage={...}
    />
  );
};

export default App;

References

Props

NameValues/TypeRequiredDefaultDescription
aspectRatio"taller" \| "wider"No"taller"Which to choose if the aspect ratios of the images are different
handleElementNo-Custom element
handleSizenumberNo40Diameter of handle
hoverbooleanNo40Whether to slide at hover
leftImagestringYesfalseLeft image's url
leftImageAltstringNo-Alt props for left image
leftImageCssobjectNo-Custom css for left image
leftImageLabelbooleanNo-Label for left Image
leftPositionLabel"top" \| "center" \| "bottom"NocenterPosition for left label
rightImagestringYes-Right image's url
rightImageAltstringNo-Alt props for right image
rightImageCssobjectNo-Custom css for right image
rightImageLabelstringNo-Label for right Image
rightPositionLabel"top" \| "center" \| "bottom"NocenterPosition for right label
skeletonElementNo-Element to use like preview
sliderLineColorstringNo"#fff"Line color of slider
sliderLineWidthnumberNo2Line width of slider (by pixel)
sliderPositionPercentagenumberNo0.5Default line position (from 0 to 1)
verticalbooleanNofalseCompare images vertically instead of horizontally. The left image is on the top and the right image is on the bottom

Events

NameParamsDescription
onSliderPositionChangeposition:numberCallback function called each time the slider changes. The position (0 to 1) of the slider is passed as arg
0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.0

7 months ago