0.1.2 • Published 5 years ago

react-awesome-image-carousel v0.1.2

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

📷 React Awesome Image Carousel 🌈

react-awesome-image-carousel is a library that allows you to easily add an image carousel to your application. There are two transition types available these being fade, and slide.

Installation

npm install --save react-awesome-image-carousel

Examples

Basic use

import React from 'react';
import ImageCarousel from 'react-awesome-image-carousel';
import image1 from '../assets/img1.jpeg';
import image2 from '../assets/img2.jpeg';
import image3 from '../assets/img3.jpeg';

const images = [{
  src: image1
},{
  src: image2
},{
  src: image3
}];

export default class Example extends React.Component {
  render() {
    return (
      <div style={{width: '100vw', height: '100vh', position: 'relative', overflow: 'hidden'}}>
        <ImageCarousel
          transition={'slide'}
          transitionDuration={0.3}
          auto
          autoDuration={3}
          coolOff={6}
          images={images}
        />
      </div>
    );
  }
}

ImageCarousel

Props

Summary

NameTypeDescription
autobooleanThis determines whether or not the images transition automatically
autoDurationnumber (seconds)This sets the duration of when to automatically transition to the next image
coolOffnumber (seconds)This is the duration for how long an image pauses before resuming the auto image transition when the next or previous buttons are clicked
disableButtonsbooleanThis will remove the previous and next buttons
dotsbooleanThis will add click-able dots to the bottom of the slider to allow the user to navigate the slidesfalse
customPrevButtoncomponentThis will remove the default left button and use a your custom component, an onClick prop will be passed in
customNextButtoncomponentThis will remove the default right button and use a your custom component, an onClick prop will be passed in
imagesarrayThis should be an array of objects with a src key value pair
transitionstringThis can either be set to 'fade' or 'slide' which will set the transition type of the images
transitionDurationnumber (seconds)This is the duration of the transition