1.1.4 • Published 2 years ago

react-stacked-carousel v1.1.4

Weekly downloads
34
License
MIT
Repository
github
Last release
2 years ago

react-stacked-carousel

Rotating Carousel with stacked cards

react-stacked-carousel

NPM JavaScript Style Guide

Install

npm install --save react-stacked-carousel

Demo

Usage

import React, {StyleSheet, useState} from 'react'
import { StackedCarousel } from 'react-stacked-carousel'
import 'react-stacked-carousel/dist/index.css';
const App = () => {
  const [card, setCard] = useState(null);
  const onCardChange = (event) => {
    console.log("Card", event);
  }
  
  return (
    <div className="main">
      <StackedCarousel
        autoRotate={false}
        onCardChange={onCardChange}
        containerClassName={"container"}
        cardClassName="card"
        leftButton={<button>{"<"}</button>}
        rightButton={<button>{">"}</button>}
      >
        <div key={'child1'}>
          <h2>1 Card</h2>
        </div>
        <div key={'child2'}>
          <h2>2 Card</h2>
        </div>
        <div key={'child3'}>
          <h2>3 Card</h2>
        </div>
        <div key={'child4'}>
          <h2>4 Card</h2>
        </div>
      </StackedCarousel>
      </div>
  )
}
export default App

Props

NameDefaultDescription
autoRotatetrueauto rotate the carousel cards after rotationInterval millioseconds are passed
rotationInterval2000Rotate a card after this time passes in milliseconds.
onCardChangenullA callback that returns the current card stack indexes object each time a card changes. The return object has this form: ({previousIndex: 0, currentIndex: 1, nextIndex: 2}).
containerClassNameThis class will be applied on the ul element
styleStyle will be applied on the ul element
cardClassNameThis class will be applied on the li element
leftButton<span>&lsaquo;</span>ReactComponent for Left button
rightButton<span>&rsaquo;</span>ReactComponent for Right button

License

MIT © saadqbal

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago