1.0.5 • Published 5 years ago
react-responsive-img-carousel v1.0.5
react-responsive-img-carousel
| Simple React image carousel that handles the responsive changes automatically
Install
npm install --save react-responsive-img-carousel
Usage
import Carousel from 'react-responsive-img-carousel'
Then declare the <Carousel />
component with the slides
prop which is an array of the image URLs.
I'd recommend handling the images like this:
import img1 from './img1'
import img2 from './img2'
import img3 from './img3'
import img4 from './img4'
function App() {
const slides = [img1, img2, img3, img4]
return <Carousel slides={slides} />
}
Props
There's currently 4 props:
- slides (required array)
- buttons (bool)
- dots (bool)
- auto (bool)
slides
Array of images you want to be used in the carousel
buttons
Buttons with an arrow SVG to slide left or right in the carousel
dots
Navigation dots to jump to selected slide
auto
Slides through the carousel, updating slide every 3 seconds
This is on by default if both buttons
and dots
were not passed as a prop. You can also use this with buttons
and/or dots