22
33Stacked card carousal component with configurable 3D transition effect.
44
5- # Getting started
5+ ## Demo
66
7- ## Install
7+ < img src = " ./demo/card-carousel.gif " width = " 300 " />
88
9- Install react-card-stack-carousel from NPM
9+ ## Getting started
10+
11+ #### Install react-card-stack-carousel from NPM
1012
1113``` sh
1214npm i react-card-stack-carousel
@@ -16,47 +18,39 @@ npm i react-card-stack-carousel
1618yarn add react-card-stack-carousel
1719```
1820
19- ## Import react-card-stack-carousel styles
21+ #### Import react-card-stack-carousel styles
2022
2123``` tsx
2224// import base styles at the top of your component
2325import " react-card-stack-carousel/dist/styles.css" ;
2426```
2527
26- # Usage
28+ ## Usage
2729
2830> NOTE: StackedCarousel requires a _ height_ property to be specified
2931
3032``` tsx
3133import React from " react" ;
3234import { StackedCarousel } from " react-card-stack-carousel" ;
33-
34- import " react-card-stack-carousel/dist/styles.css" ;
35+ import " react-card-stack-carousel/dist/styles.css" ; // import base styles
3536
3637export default function App() {
37- const cardWidth = 500 ;
38- const cardHeight = 500 ;
38+ // specify container height
39+ const containerHeight = 500 ;
3940
40- const cardStyles = { width: cardWidth , height: cardHeight };
4141 return (
4242 <main className = " container" >
43- <StackedCarousel height = { cardHeight } >
44- <div className = " sample-card bg-color-1" style = { cardStyles } >
45- 0
46- </div >
47- <div className = " sample-card bg-color-2" style = { cardStyles } >
48- 1
49- </div >
50- <div className = " sample-card bg-color-3" style = { cardStyles } >
51- 2
52- </div >
43+ <StackedCarousel height = { containerHeight } >
44+ <div className = " sample-card bg-color-1" >0</div >
45+ <div className = " sample-card bg-color-2" >1</div >
46+ <div className = " sample-card bg-color-3" >2</div >
5347 </StackedCarousel >
5448 </main >
5549 );
5650}
5751```
5852
59- # Props
53+ ## Props
6054
6155| Prop | Type | Default | Required | Description |
6256| ----------------------- | --------- | ------------------------------------ | -------- | ------------------------------------------------- |
@@ -74,7 +68,7 @@ export default function App() {
7468| ` transitionDuration ` | number | 400 | No | Duration of the transitions in milliseconds. |
7569| ` verticalOffset ` | number | 10 | No | % vertical offset for the carousel items. |
7670
77- # Running locally
71+ ## Running locally
7872
79731 . Clone the repo and install the dependencies. In the repo's root, run
8074
@@ -99,7 +93,7 @@ cd ./playground
9993yarn dev
10094```
10195
102- # Todo
96+ ## Todo
10397
104- [ ] Auto compute the container height based on height of the active card
105- [ ] Plugin system to enable custom transition styles
98+ - [ ] Auto compute the container height based on height of the active card
99+ - [ ] Plugin system to enable custom transition styles
0 commit comments