A carousel that renders medias such as images or videos using React.
To install, run in a terminal :
# using npm
npm install --save playeurzero/react-carousel
# using yarn
yarn add playeurzero/react-carousel
# using npm
npm install --save playeurzero/react-carousel#v1.0.0
# using yarn
yarn add playeurzero/react-carousel#v1.0.0
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import Carousel from 'react-carousel'
ReactDOM.render(
(
<Carousel>
<Carousel.Slide>Your content...</Carousel.Slide>
<Carousel.Slide><img src="./myAwesomeImage.jpg" /></Carousel.Slide>
</Carousel>
),
document.querySelector('.app')
)
import React from 'react'
import ReactDOM from 'react-dom'
import Carousel from 'react-carousel'
ReactDOM.render(
(
<Carousel>
<Carousel.Slide>Your content...</Carousel.Slide>
<Carousel.Slide><img src="./myAwesomeImage.jpg" /></Carousel.Slide>
</Carousel>
),
document.querySelector('.app')
)
number?
= 1500
(in ms)
The delay the slide take to swipe.
boolean?
= false
Hide navigation with arrows.
boolean?
= false
Hide navigation with dots.
number?
= 0.5625
The aspect the Carousel should take. By default: 16:9.
boolean?
= false
Disable touch detection (no events will be created).
Be careful, passing this props from true
to false
will no disable touch events.
boolean?
= false
Disable mouse touch detection (no events will be created).
Be careful, passing this props from true
to false
will no disable mouse touch events.
Mouse touch events allows user to move a slide using the mouse cursor.
boolean?
= false
The carousel will swipe go to the next page automatically after a delay.
number?
= 3000
(in ms)
The delay until the next page will be swiped.
The delay is added with the transitionDuration
prop.
boolean?
= true
Prevent the carousel from swiping when it is hovered.
number?
= 0
Defines the default active slide. Using this props will no leed to a controlled value. It justs define the default value for startup.
If you want to control which slide is active, use activeSlide
prop instead.
number?
Defines the active slide. This is a controlled value, so you need a container to handle which slide to show.
(active: boolean) => ReactElement?
Should return a React.ReactElement
to define how to render a dot.
It can be useful if you want to customize how the dot should be renderer depending of the an external style sheet.
() => ReactElement?
Should return a React.ReactElement
to define how to render the left arrow.
It can be useful if you want to customize how the dot should be renderer depending of the an external style sheet.
() => ReactElement?
Should return a React.ReactElement
to define how to render the right arrow.
It can be useful if you want to customize how the dot should be renderer depending of the an external style sheet.
<Carousel.Slide>
It contains the list of <Carousel.Slide>
(activeSlide: number) => void
Fired when a slide changes. It is also fired when autoplay.
(() => React.ReactNode)?
Replace the first "transition" slide at the end of the infinite carousel. It avoids DOM duplication in case where you want to play a video with an "autoplay" option.
(() => React.ReactNode)?
Replace the last "transition" slide at the end of the infinite carousel. It avoids DOM duplication in case where you want to play a video with an "autoplay" option.
React.ReactNode
The content of the slide (an image, a video or an iframe).