Skip to content
On this page

API Reference

Props

Prop (* required)typedefaultdescription
leftImage *stringnullleft image's url
rightImage *stringnullright image's url
verticalbooleanfalseCompare images vertically or horizontally
keyboardbooleantrueAllow Keyboard navigation for accessibility
keyboardStepnumber0.01By what percentage should the slider move on keyboard press. between 0 and 1
aspectRatio'taller' or 'wider''taller'Which to choose if the aspect ratios of the images are different
handleelementnullCustom handle element. Just pass and empty <div /> if you want to remove the handle.
handleSizenumber (px)40diameter of slider handle (by pixel)
hoverbooleanfalseWhether to slide at hover
slideOnClickbooleantrueWhether to slide on click and drag or just drag.
leftImageAltstring''alt props for left image
leftImageCssobject{}Additional css for left image
leftImageLabelstringnullLabel for the image (e.g. before)
onSliderPositionChangefunctionnullCallback function called each time the slider changes. The position (0 to 1) of the slider is passed as arg
rightImageAltstring''alt props for right image
rightImageCssobject{}Additional css for right image
rightImageLabelstringnullLabel for the image (e.g. after)
skeletonelementnullElement displayed while image is loading
sliderLineColorstring'#ffffff'line color of slider
sliderLineWidthnumber (px)2line width of slider (by pixel). set 0 to hide slider line.
sliderPositionPercentagenumber (float)0.5Default slider line position (from 0 to 1)

Events

NameDescription
slideStartWhen sliding has starts
slideEndWhen sliding ends
isSlidingtrue when sliding