Note: this component relies on getDerivedStateFromProps and requires react@16.4 or newer. For older react versions please install react-animated-slider version 1:
Index of the slide that will be initially displayed.
duration
number
2000(ms)
Duration of the animation in milliseconds. It is used to remove the animateIn and animateOut classNames and assign current after the transition has completed.
disabled
boolean
false
Disable slider navigation
infinite
boolean
true
Enable or disable infinite loop through slides. Sliders with only 2 children will have this option set to false
autoplay
number
undefined
Autoplay interval in miliseconds. If undefined the slider will not play automatically. The timer will be paused and reset during user interactions such as mouse over or touch, to avoid sliding away the elements when the user wants to click them.
touchDisabled
boolean
false
Disable slider navigation through touch events
minSwipeOffset
number
15(px)
Minimum distance in pixels to swipe for triggering a navigation event
previousButton
ReactElement
arrow svg
Will be rendered inside the previous button
nextButton
ReactElement
arrow svg
Will be rendered inside the next button
classNames
object
see below
Object representing the CSS classNames that will be apllied to the slides.
a slide that is not visible and is not adjacent to the current slide, therefore no animation will be applied
previous
the slide that will appear or is appearing when the slider navigated back
next
the slide that will appear or is appearing when the slider navigated forward
animateIn
the slide moving into the view
animateOut
the slide moving out of the view
Events
property
description
onSlideChange
called after a slide change animation has ended. Receives an object with the new slide index as argument: <Slider onSlideChange={event => console.log(event.slideIndex)}>