0.4.0 • Published 5 years ago

@ryo_suga/react-isomorphic-carousel v0.4.0

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

react-isomorphic-carousel

Isomorphic React Carousel Component.

  • Isomorphic
  • Responsive
  • Touch and Swipe (is not draggable yet)

WIP: It is still under development.

Install

npm i @ryo_suga/react-isomorphic-carousel

Usage

import * as React from 'react';
import * as Carouse from '@ryo_suga/react-isomorphic-carousel';

React.render(
  <Carousel>
    <img src="//placehold.it/320x160?text=a" />
    <img src="//placehold.it/320x160?text=b" />
    <img src="//placehold.it/320x160?text=c" />
  </Carousel>,
  document.getElementById('app')
);

Carousel

Props

nametypedescription
useDotsbooleanuse dots or not. (default false)
dotStyleReact.CSSPropertiescustom css properties for dot button. (default {})
activeDotStyleReact.CSSPropertiescustom css properties for the active dot button. (default {})
durationnumbermiliseconds for animation speed. (default 500)
autoSlideIntervalnumbermiliseconds for auto slide. if 0 or less than 0, auto slide disabled. (default 0)

Next/Prev Button

if you want to call next or prev to move slide position from script, use ref to get Carousel instance.

class App extends React.Component {
  carousel: Carousel
  render() {
    <div>
      <Carousel
        ref={(instance) => { this.carousel = instance; }}
      >
        {/* some element */}
      </Carousel>
      <button
        onClick={() => {
          // call prev
          this.carousel && this.carousel.prev();
        }}
      >
        prev
      </button>
      <button
        onClick={() => {
          // call next
          this.carousel && this.carousel.next();
        }}
      >
        next
      </button>
    </div>
  }
}

Develop

npm start

Test

npm test
0.4.0

5 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago