Skip to content

dajk/react-carousel

Repository files navigation

react-carousel

Carousel for React

npm codecov npm bundle size

Install

npm install @dajk/react-carousel

or

yarn add @dajk/react-carousel

Usage

import React from 'react'
import Carousel from '@dajk/react-carousel'

export const items = [
  { backgroundColor: 'blue', color: 'white' },
  { backgroundColor: 'red', color: 'white' },
  { backgroundColor: 'green', color: 'white' },
  { backgroundColor: 'yellow', color: 'black' },
]

const MyCarousel = () => {
  return (
    <Carousel>
      {items.map((item, index) => {
        return (
          <div
            key={index}
            style={{
              height: 200,
              display: 'flex',
              alignItems: 'center',
              justifyContent: 'center',
              ...item,
            }}
          >
            {index}
          </div>
        )
      })}
    </Carousel>
  )
}

License

MIT © dajk