1.0.2 • Published 1 year ago

xrayimages v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

xRayImages

xRayImages is a React library for moving an image on top of another using a slider.

Screenshot

App Screenshot

Installation

  • Using npm
  npm i xrayimages
  • Using yarn
  yarn add xrayimages

Example usage

import { useState } from 'react';
import { XRayContainer, XRaySlider} from 'xrayimages'
import backgroundImage from './assets/backgroundImage.jpg'
import xrayImage from './assets/xrayImage.jpg'

function App() {
  const [sliderPosition, setSliderPosition] = useState(0)

  return (
    <>
      <XRayContainer
        sliderPosition={sliderPosition}
        backgroundImage={backgroundImage}
        xrayImage={xrayImage}
      />
      <XRaySlider
        sliderPosition={sliderPosition}
        setSliderPosition={setSliderPosition}
      />
    </>
  )
}

XRayContainer props

PropTypeDescriptionExample
sliderPositionnumberSlider position
backgroundImagestringFull background image
xrayImagestringxRay image
width?=800number | stringContainer widthwidth={1200} or width='50%'
frameWidth?=200number | stringFrame xRay widthwidth={200} or width='300px'
frameColor?='#d7b4f1'stringFrame border color
frameBorderWidth?=1numberFrame border width
backdrop?=0numberDarkening the full backgroundbackdrop={0.4}
...propsResidual props such as className, style and others

XRaySlider props

PropTypeDescriptionExample
width?=200numberSlider widthwidth={200} or width='50%'
sliderPositionnumberSlider position
setSliderPositionReact.Dispatch<React.SetStateAction>Setting the slider position state
...propsResidual props such as className, style and others
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago