0.0.9 • Published 5 years ago

ac-react-simple-image-slider v0.0.9

Weekly downloads
17
License
MIT
Repository
github
Last release
5 years ago

ac-react-simple-image-slider

A simple image slider built with React, emotion and hooks

NPM JavaScript Style Guide

Install

npm install --save ac-react-simple-image-slider

or

yarn add ac-react-simple-image-slider

Usage

Example usage

import React from 'react';
import ImageSlider from 'ac-react-simple-image-slider';

const imageData = [
  {
    src: 'https://placeimg.com/640/480/any',
    title: 'Image 1'
  },
  {
    src: 'https://placeimg.com/640/480/any',
    title: 'Image 2'
  }
];

const Example = () => (
  <ImageSlider height='640px' width='480px' data={imageData} />
);

Props

NameTypeDefaultDescription
initialIndexnumber0The index of the initial slide image. 0 points to first slide image.
heightstring100%Custom slider height. e.g.: 640px
widthstring100%Custom slider width. e.g.: 480px
dataarrayOfObject[](required) Slider images array.
-> srcstring-(required) Slider item image URL.
-> titlestring-(required) Slider item title. This also be used for alternative image text.
showArrowsbooltrueWhether the navigation arrows will display or not
showDotsbooltrueWhether the dots will display bottom of the slider or not
autoPlaybooltrue(optional) Whether the slideshow should start automatically
durationnumber3(optional) How long wait (seconds) before the next transition starts. It also uses by animation duration
infiniteboolfalse(optional) Whether the transition should loop throughout
elementWrapperStylesobjectnull(optional) Slide image wrapper styles
itemStylesobjectnull(optional) Slide image style

Todo

  • Tests
  • Add following props:
NameTypeDefaultDescription
dotComponentnodenullCustom component for the dots
leftArrowComponentstring<Custom left arrow
rightArrowComponentstring>Custom right arrow

License

MIT © abdullahceylan