react-awesome-image-carousel

0.1.2 • Public • Published

📷 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

Slide

Fade

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

Name Type Description
auto boolean This determines whether or not the images transition automatically
autoDuration number (seconds) This sets the duration of when to automatically transition to the next image
coolOff number (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
disableButtons boolean This will remove the previous and next buttons
dots boolean This will add click-able dots to the bottom of the slider to allow the user to navigate the slides
customPrevButton component This will remove the default left button and use a your custom component, an onClick prop will be passed in
customNextButton component This will remove the default right button and use a your custom component, an onClick prop will be passed in
images array This should be an array of objects with a src key value pair
transition string This can either be set to 'fade' or 'slide' which will set the transition type of the images
transitionDuration number (seconds) This is the duration of the transition

Package Sidebar

Install

npm i react-awesome-image-carousel

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

30.7 kB

Total Files

4

Last publish

Collaborators

  • mikeham98