@another-ui/carousel
TypeScript icon, indicating that this package has built-in type declarations

0.18.0 • Public • Published

@another-ui/carousel

Just another carousel component for React

Usage

import React from 'react';
import { Carousel, CarouselProvider, useCarousel } from '@another-ui/carousel';
import '@another-ui/carousel/dist/carousel.css';

const SlideOne = () => <h1>Slide One</h1>;
const SlideTwo = () => <h1>Slide Two</h1>;
const SlideThree = () => <h1>Slide Three</h1>;

const Controller = () => {
  const {
    previous,
    next,
    PreviousSlide,
    NextSlide,
  } = useCarousel();

  return (
    <div>
      <button
        disabled={!PreviousSlide}
        onClick={() => previous()}
        type="button"
      >
        Previous
      </button>
      <button
        disabled={!NextSlide}
        onClick={() => next()}
        type="button"
      >
        Next
      </button>
    </div>
  );
};

export const Example = () => (
  <CarouselProvider initial={1} slides={[SlideOne, SlideTwo, SlideThree]}>
    <Carousel className="custom-class" theme="dark" />
    <Controller />
  </CarouselProvider>
);

Package Sidebar

Install

npm i @another-ui/carousel

Weekly Downloads

5

Version

0.18.0

License

MIT

Unpacked Size

30.1 kB

Total Files

26

Last publish

Collaborators

  • nghuudan