Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

tiny-slider-react

jechav16.9kISC0.5.7TypeScript support: definitely-typed

wrapper tiny-slider plugin for react

tiny-slider, carousel, react

readme

tiny-slider-react

Original plugin tiny-slider

Tiny Slider v2 <=> tiny-slider-react >= v5

Tiny Slider v1 <=> tiny-slider-react <= v4

demo demo2

props

prop decription
settings options slider
onClick callback to return slide clicked (slideClicked, info, event)
startIndex index of carousel initiation
onIndexChanged event bind
onTransitionStart event bind
onTransitionEnd event bind
onTouchStart event bind
onTouchMove event bind
onTouchEnd event bind
import TinySlider from "tiny-slider-react";
import 'tiny-slider/dist/tiny-slider.css';

const settings = {
  lazyload: true,
  nav: false,
  mouseDrag: true
};

<TinySlider settings={settings}>
    {imgs.map((el, index) => (
      <div key={index} style={{ position: "relative" }}>
        <img
          className={`tns-lazy-img`}
          src={loadingImage}
          data-src={el}
          alt=""
          style={imgStyles}
        />
      </div>
    ))}
</TinySlider>

How to use external buttons for prev & next

const settings = {
  lazyload: true,
  nav: false,
  mouseDrag: true,
  controls: false // remove built-in nav buttons
}

Get the slider from refs:

<TinySlider settings={settings} ref={ts => this.ts = ts}>...</TinySlider>

Add onClick for your buttons:

<button type="button" onClick={() => this.onGoTo('prev')}>Previous</button>
<button type="button" onClick={() =>  this.onGoTo('next')}>Next</button>

Add the handler on your component:

onGoTo = dir => this.ts.slider.goTo(dir)

changelog

0.5.7 (March 22, 2023)

  • fix: fix the import of tiny-slider
  • fix: remove package-lock.json and update yarn.lck

0.5.6 (July 08, 2022)

  • Merge branch 'master' of github.com:jechav/tiny-slider-react
  • Merge pull request #51 from fabdts/master
  • [#50] Fix lazy destroy validation in build
  • Bump version to 0.5.5.
  • patch fix lazy destroy validation
  • Merge pull request #48 from mcaliskann/patch-1
  • Update Carousel.js
  • fix version matching with npm

0.5.5 (May 26, 2022)

0.5.5 (enero 14, 2022)

0.5.4 (Oct 27, 2021)

  • Support Next.js

0.5.3 (July 10, 2020)

  • Merge branch 'master' of github.com:jechav/tiny-slider-react
  • Update README.md

0.5.2 (June 27, 2020)

  • upgrade v0.5.2
  • fix rebuild

0.5.1 (June 27, 2020)