# react-stacked-carousel

> Rotating Carousel with stacked cards

Latest version **1.1.4** (published 2022-03-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-stacked-carousel
pnpm add react-stacked-carousel
yarn add react-stacked-carousel
bun add react-stacked-carousel
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2022-03-03 |
| First published | 2020-12-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 37 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | saadqbal |
| Maintainers | saadqbal |

## Links

- npm: https://www.npmjs.com/package/react-stacked-carousel
- Repository: https://github.com/saadqbal/react-stacked-carousel
- Homepage: https://github.com/saadqbal/react-stacked-carousel#readme
- Issues: https://github.com/saadqbal/react-stacked-carousel/issues
- npm.io page: https://npm.io/package/react-stacked-carousel

## Recent versions

- 1.1.4 (latest) — 2022-03-03
- 1.1.3 — 2022-03-02
- 1.1.2 — 2020-12-30
- 1.1.1 — 2020-12-29
- 1.1.0 — 2020-12-28
- 1.0.9 — 2020-12-28
- 1.0.8 — 2020-12-26
- 1.0.7 — 2020-12-22
- 1.0.6 — 2020-12-15
- 1.0.5 — 2020-12-09
- 1.0.4 — 2020-12-07
- 1.0.3 — 2020-12-07
- 1.0.2 — 2020-12-07
- 1.0.1 — 2020-12-07
- 1.0.0 — 2020-12-04

## README

# react-stacked-carousel

> Rotating Carousel with stacked cards

![react-stacked-carousel](screen.gif)

[![NPM](https://img.shields.io/npm/v/react-stacked-carousel.svg)](https://www.npmjs.com/package/react-stacked-carousel) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

# Install

```bash
npm install --save react-stacked-carousel
```


# [Demo](http://asadiqbal.me/react-stacked-carousel/)



# Usage


```jsx
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
|Name| Default | Description |
|--|--|--|
| `autoRotate` | true | auto rotate the carousel cards after `rotationInterval` millioseconds are passed |
|`rotationInterval` | 2000 | Rotate a card after this time passes in **milliseconds**.  |
|`onCardChange`| null | A 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}`).|
|`containerClassName` |  | This class will be applied on the **ul** element |
|`style` |  | Style will be applied on the **ul** element |
|`cardClassName` |  | This 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](https://github.com/saadqbal)

---
_Source: https://npm.io/package/react-stacked-carousel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
