React Alice Carousel
React Alice Carousel is a React component for building content galleries, content rotators and any React carousels.
Features of react-alice-carousel
- Infinite loop
- FadeOut animation
- AutoPlay mode
- Mobile friendly
- Responsive design
- Swipe to slide
- Start index
- Slide to index
- RTL
- Keyboard navigation
- Touch and Drag support
- Custom rendered slides
- Custom animation duration
- Multiple items in the slide
- Show / hide anything (indicators, arrows, slides indexes)
How to use
Style import
# SCSS
@import "react-alice-carousel/src/alice-carousel.scss";
# CSS
@import "react-alice-carousel/lib/alice-carousel.css";
# Webpack
import "react-alice-carousel/lib/alice-carousel.css";
Quick start
Advanced configuration
Props
-
duration
: Number, default250
- Duration of slides transition (milliseconds) -
responsive
: Object, default{}
- Number of items in the slide -
buttonsDisabled
: Boolean,false
- Disable buttons control -
dotsDisabled
: Boolean,false
- Disable dots navigation -
startIndex
: Number,0
- The starting index of the carousel -
slideToIndex
: Number,0
- Sets the carousel at the specified position -
swipeDisabled
: Boolean, defaultfalse
- Disable swipe handlers -
mouseDragEnabled
: Boolean, defaultfalse
- Enable mouse drag animation -
infinite
: Boolean, defaulttrue
- Disable infinite mode -
fadeOutAnimation
: Boolean,false
- Enable fadeout animation. Fired when 1 item is in the slide -
keysControlDisabled
: Boolean, defaultfalse
- Disable keys controls (left, right, space) -
playButtonEnabled
: Boolean, defaultfalse
- Disable play/pause button -
autoPlay
: Boolean, defaultfalse
- Set auto play mode -
autoPlayInterval
: Number, default250
- Interval of auto play animation (milliseconds). If specified, a larger value will be taken from comparing this property and theduration
one -
autoPlayDirection
: String, defaultltr
- To run auto play in the left direction specifyrtl
value -
autoPlayActionDisabled
: Boolean, defaultfalse
- If this property is identified astrue
auto play animation will be stopped after clicking user on any gallery button -
stopAutoPlayOnHover
: Boolean, defaulttrue
- If this property is identified asfalse
auto play animation won't stopped on hover -
showSlideIndex
: Boolean, defaultfalse
- Show slide index info -
onSlideChange
: Function - Fired when the event object is changing / returns event object -
onSlideChanged
: Function - Fired when the event object was changed / returns event objectBoth functions return next object
Examples
Custom Prev / Next
buttons, dots / thumbs
navigation:
- Using - refs.
- Using props