1.0.1 • Published 3 years ago

@tappiola/carousel-component v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
3 years ago

React carousel

Demo

Features

  • Sliding animations
  • Works for mobile and desktop devices
  • Easy customization
  • Supports swipes on touch devices
  • Supports infinite option
  • Autoplay
  • Customizable autoplay intervals
  • Adjustable animation duration
  • Pause autoplay on mouseover
  • Supports scrolling to a selected slide
  • Current slide indicator
  • Works for any HTML content as children

Usage example

Wrapping each slide content into <Carousel.Item/> is obligatory.

import {Carousel} from './Carousel';
import React from "react";

function App() {
  return (
    <div>
      <Carousel width="500px" height="400px" backgroundColor="lightgray" infinite={true} autoplay={true}>
        <Carousel.Item>
          <div style={{display: 'flex', textAlign: 'center', justifyContent: 'center'}}>
            <article>
              <p><b>First slide</b></p>
              <p>This is generic text about first slide</p>
            </article>
          </div>
        </Carousel.Item>
        <Carousel.Item>
          <div style={{display: 'flex', textAlign: 'center', justifyContent: 'center'}}>
            <article>
              <p><b>Second slide</b></p>
              <p>This is generic text about second slide</p>
            </article>
          </div>
        </Carousel.Item>
      </Carousel>
    </div>
  );
}

export default App;

Properties

propertytypedefaultdescription
autoplaybooleantrueEnable or disable playing slides automatically.
infinitebooleanfalseEnable or disable going to the first slide after the last one.
slideDurationnumber (milliseconds)500Transition duration for changing slides.
automaticSlideIntervalnumber (milliseconds)5000Changing slides interval.
heightAny CCS units (px, %, em, etc.)50%Changing slides interval.
widthAny CCS units (px, %, em, etc.)50%Changing slides interval.
Otherany-Any other styling options to be applied to Carousel container, e.g. container width.