1.1.0 • Published 4 years ago

nice-react-carousel v1.1.0

Weekly downloads
48
License
MIT
Repository
github
Last release
4 years ago

Try it

https://nice-react-carousel.netlify.com

Install it

npm

npm i nice-react-carousel

yarn

yarn add nice-react-carousel

Use it

import Carousel from 'nice-react-carousel';

Documentation

OptionTypeDefaultDescription
modestring ('normal', 'center' 'variableWidth')'normal'How items should be displayed.
itemsBySlidenumber1Items number for each slide. Works only with 'normal' mode.
spacenumber10Space between each item (px).
itemsWidthnumber100Width of each item(px). Works only with 'variableWidth' mode.
arrowsbooleantrueShould show the arrow buttons (previous/next) when it's possible.
dotsfunction | booleanfalseOn / Off the dots. Or custom your own dots (See the example below).
customNextArrowReactElementCustom the next button.
customPrevArrowReactElementCustom the previous button.
responsiveObject{breakpoint: number, ...}Change properties depending on the breakpoint (Mobile first).

Basic example

<Carousel mode="normal" itemsBySlide={2} dots>
  <div>Slider 1</div>
  <div>Slider 2</div>
  <div>Slider 3</div>
</Carousel>

Props usage examples

  • Custom dots :
  dots = {active => {
    return (
      <span>[{active ? 'x': ''}]</span>
    );
  }}
  • Responsive (Mobile first) :
  responsive = {[
    {
      breakpoint:800,
      space: 10,
      itemsWidth: 200
    },
    {
      breakpoint:1200,
      space: 15,
      itemsWidth: 250,
      dots: false,
    },
  ]}

Help ?

Open an issue for all your question, request or anything else just here :

https://github.com/renadr/nice-react-carousel/issues