1.2.1 • Published 6 years ago

react-light-carousel v1.2.1

Weekly downloads
9
License
MIT
Repository
github
Last release
6 years ago

React-Light-Carousel

A light weight react based carousel for multiple purposes.

Features

  • Autoplay
  • Infinite mode
  • Responsive (all the breakpoints you need)
  • Custom buttons

Install

  npm i react-light-carousel

Basic usage

const BasicCarousel = () => {
  return (
    <LightCarousel gap={20} showControls>
      <span>slide 1</span>
      <span>slide 2</span>
      <span>slide 3</span>
    </LightCarousel>
  );
}

Responsive example

const breakpoints = {
  0: 1, // Show 1 slide for default
  400: 2, // Show 2 slides after 400px
  1000: 4,  // Show 4 after 1000px
}

const ResponsiveCarousel = () => {
  return (
    <LightCarousel gap={20} responsive={breakpoints} showControls>
      <span>slide 1</span>
      <span>slide 2</span>
      <span>slide 3</span>
    </LightCarousel>
  );
}

Props

NameTypeDefaultDescrption
slidesToShownumber1The number of slides to show at the same time
setSlidenumber0To set the slide you want to be focused (you can use it to set an initial slide)
gapnumber0The space between each slide
autoplaybooleanfalseThe slideshow starts moving automatically
speednumber3000The speed of the autoplay
stopOnHoverbooleantrueWhen true, stops the autoplay temporarily when the mouse is over the slideshow
infinitebooleanfalseMakes the slideshow restart the slides when reaching the end
showControlsbooleanfalseTo show the previous and next slide buttons
prevBtnstring or component'prev'The previous slide button
nextBtnstring or component'next'The next slide button
responsiveobject{}You can pass an object to tell the slideshow how many slides to show on a given breakpoint (in pixels)
onPreviousSlidefunction() => {}Callback when it finish sliding to previous slide
onNextSlidefunction() => {}Callback when it finish sliding to next slide
1.2.1

6 years ago

1.2.0

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago