1.0.2 • Published 4 years ago

react-standard-carousel v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

react-standard-carousel

this carousel is simple and minimum that use in many situations.

MIT License

Tech

Installation

npm install [--save-dev] react-standard-carousel

Usage

import React from 'react';
import Carousel from 'react-standard-carousel';

const App = () => {
  return (
    <div style={{width: '400px', height: '600px'}}>
      <Carousel>
        <img src="/img/example1.jpg" />
        <img src="/img/example2.jpg" />
        <img src="/img/example3.jpg" />
      </Carousel>
    </div>
  );
}

export default App;

or

import React from 'react';
import { Link } from 'react-router-dom';
import Carousel from 'react-standard-carousel';

const App = () => {
  return (
    <div style={{width: '400px', height: '600px'}}>
      <Carousel>
        <div className="slide">
          <img src="/img/example1.jpg" />
          <Link to="/christmas" className="slide__title">
            MERRY CHRISTMAS
          </Link>
        </div>
        <div className="slide">
          <img src="/img/example2.jpg" />
          <Link to="/santa-claus" className="slide__title">
            Lets gift to Santa Claus
          </Link>
        </div>
      </Carousel>
    </div>
  );
}

export default App;

TypeScript:

import React from 'react';
import Carousel from 'react-standard-carousel';

const App: React.FC = () => {
  return (
    <div style={{width: '400px', height: '600px'}}>
      <Carousel>
        <img src="/img/example1.jpg" />
        <img src="/img/example2.jpg" />
        <img src="/img/example3.jpg" />
      </Carousel>
    </div>
  );
}

export default App;

Props

<Carousel
  dots={true}
  dotWidth={6}
  dotMargin={5}
  dotBorderWidth={2}
  arrow={true}
  arrowWidth={20}
  arrowBorderWidth={2}
  transition={300}
  autoPlay={true}
  autoPlayMsec={3000} >
PropsTypeDefaultRequiredDescription
childrenstring|nodeYesChildren is a special React property.
dotsbooleantrueNoShow dots or hide.
dotWidthnumber6NoWidth and height of dot. unit is 'px'.
dotMarginnumber5NoMargin of dot. unit is 'px'.
dotBorderWidthnumber2NoWidth of border for dot. unit is 'px'.
arrowbooleantrueNoShow arrow icon or hide.
arrowWidthnumber20NoWidth and height of arrow icon. unit is 'px'.
arrowBorderWidthnumber2NoWidth and height of border for arrow icon. unit is 'px'.
transitionnumber300NoTime that during move carousel. unit is 'msec'.
autoPlaybooleanfalseNoStart with auto.
autoPlayMsecnumber3000NoInterval. unit is 'msec'.

Example

$ git clone git://github.com/hktysk/react-standard-carousel.git
$ cd react-standard-carousel
$ npm install
$ npm start
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago