npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-motion-slider

v0.4.1

Published

Slider/Carousel powered by React Motion.

Downloads

83

Readme

React Motion Slider

Dependency Status

Slider/Carousel powered by React Motion.

react-motion-slider

Usage

npm install react-motion-slider --save

bower install react-motion-slider --save

Example Usage

<div>
  <Slider
    ref="slider"
    currentKey="slide-3" // move to a specific slide by passing its key
    autoHeight={true} // animate slider wrapper
  >
    {this.state.slides.map((slide, i) =>
      <li key={`slide-${i}`} className="slide" />
    )}
  </Slider>
  <nav className="slider__controls">
    <a
      className="slider__control slider__control--prev"
      onClick={() => this.refs['slider'].prev()}
    >
      Prev
    </a>
    <a
      className="slider__control slider__control--next"
      onClick={() => this.refs['slider'].next()}
    >
      Next
    </a>
  </nav>
</div>

Props

currentKey: PropTypes.any

Move to a slide by its key.

currentIndex: PropTypes.number

Move to a slide by its index.

slidesToShow: PropTypes.number

The amount of slides shown in view. Defaults to 1.

slidesToMove: PropTypes.number

The amount of slides to move upon using prev and next methods. Defaults to 1.

autoHeight: PropTypes.bool

Animates the wrapper height to fit the current slide. Defaults to false.

align: PropTypes.oneOf(['left', 'center', 'right'])

Offsets the slide to align either left (default), center, or right.

swipe: PropTypes.oneOf([true, false, 'touch', 'mouse'])

Enable touch and/or mouse dragging. Defaults to true.

swipeThreshold: PropTypes.number

The amount the user must swipe to advance slides. (sliderWidth * swipeThreshold). Defaults to 0.5

flickTimeout: PropTypes.number

The amount of time in milliseconds that determines if a swipe was a flick or not.

springConfig: React.PropTypes.objectOf(React.PropTypes.number)

Accepts a React Motion spring config.

beforeSlide: PropTypes.func(currentIndex, nextIndex)

Prop callback fired before slide change.

afterSlide: PropTypes.fun(currentIndex)

Prop callback fired after slide change.

Public methods

prev

Moves to the previous slide.

next

Advances to the next slide.

Running Locally

clone repo

git clone [email protected]:souporserious/react-motion-slider.git

move into folder

cd ~/react-motion-slider

install dependencies

npm install

run dev mode

npm run dev

open your browser and visit: http://localhost:8080/