1.2.0 • Published 12 months ago

carousel-selector v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Carousel

A simple and customizable carousel component for React.

Storybook

Installation

You can install the package via npm:

npm install carousel-selector

Make sure you have react and react-dom installed as peer dependencies:

npm install react react-dom

Usage

Here's a basic example of how to use the Carousel component in your project:

import React, { useState } from "react"
import { Carousel } from "carousel-selector"

const App = () => {
  const [selectedItem, setSelectedItem] = useState(null)

  const handleChange = (itemAtFront) => {
    setSelectedItem(itemAtFront)
  }

  return (
    <div>
      <h1>My Carousel Example</h1>
      <Carousel
        options={[1, 2, 3, 4, 5, 6, 7, 8, 9]}
        onChange={handleChange}
        initialOption={1}
      />
      <p>Selected Item: {selectedItem}</p>
    </div>
  )
}

export default App

Props

Carousel

PropTypeDescriptionDefault
optionsany[]Array of items to display in the carousel.[1, 2, 3, 4, 5, 6, 7, 8, 9]
onChangefunctionCallback function called when the front item changes.null
initialOptionanyThe initial item to be shown at the front of the carousel.null

Development

To set up the development environment:

  1. Clone the repository:
git clone https://github.com/your-username/my-carousel.git
cd my-carousel
  1. Install the dependencies:
npm install
  1. Build the project:
npm run build

Contributing

If you have suggestions for how this project can be improved, or want to report a bug, open an issue! We'd love all and any contributions. If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.

License

This project is licensed under the MIT License - see the LICENSE file for details.

1.2.0

12 months ago

1.1.0

12 months ago

1.0.0

12 months ago