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-slider-fork

v0.6.0

Published

Slider component for React

Downloads

7

Readme

React Slider

CSS agnostic slider component for React.

See demo: https://mpowaga.github.io/react-slider/

Important Note

This is an alpha release. Use with caution and hope.

Installation

npm install react-slider

Overview

Single slider:

Similar to <input type="range" defaultValue={50} />

React.render(<ReactSlider defaultValue={50} />, document.body);

Double slider (with bars between the handles):

React.render(<ReactSlider defaultValue={[0, 100]} withBars />, document.body);

Multi slider:

React.render(<ReactSlider defaultValue={[0, 33, 67, 100]} withBars />, document.body);

Provide custom handles:

React.render(
  <ReactSlider withBars>
    <div className="my-handle">1</div>
    <div className="my-handle">2</div>
    <div className="my-handle">3</div>
  </ReactSlider>,
  document.body
);

Now you can style it as you want. Checkout the index.html example to see how.

Properties

min {number} default: 0

The minimum value of the slider.

max {number} default: 100

The maximum value of the slider.

step {number} default: 1

Value to be added or subtracted on each step the slider makes. Must be greater than zero. max - min should be evenly divisible by the step value.

minDistance {number} default: 0

The minimal distance between any pair of handles. Zero means they can sit on top of each other.

defaultValue {oneOfType([number, arrayOf(number)])} default: 0

Determines the initial positions of the handles and the number of handles if the component has no children.

If a number is passed a slider with one handle will be rendered. If an array is passed each value will determine the position of one handle. The values in the array must be sorted. If the component has children, the length of the array must match the number of children.

value {oneOfType([number, arrayOf(number)])} default: 0

Like defaultValue but for controlled components.

orientation {oneOf(['horizontal', 'vertical'])} default: 'horizontal'

Determines whether the slider moves horizontally (from left to right) or vertically (from top to bottom).

className {string} default: 'slider'

The css class set on the slider node.

handleClassName {string} default: 'handle'

The css class set on each handle node. In addition each handle will receive a numbered css class of the form ${handleClassName}-${i}, e.g. handle-0, handle-1, ...

handleActiveClassName {string} default: 'active'

The css class set on the handle that is currently being moved.

withBars {boolean} default: false

If true bars between the handles will be rendered.

barClassName {string} default: 'bar'

The css class set on the bars between the handles. In addition bar fragment will receive a numbered css class of the form ${barClassName}-${i}, e.g. bar-0, bar-1, ...

pearling {bool} default: false

If true the active handle will push other handles within the constraints of min, max, step and minDistance.

disabled {bool} default: false

If true the handles can't be moved.

snapDragDisabled {bool} default: false

Disables handle move when clicking the slider bar.

invert {bool} default: false

Inverts the slider.

onBeforeChange {func}

Callback called before starting to move a handle.

onChange {func}

Callback called on every value change.

onAfterChange {func}

Callback called only after moving a handle has ended or when a new value is set by clicking on the slider.

onSliderClick {func}

Callback called when the the slider is clicked (handle or bars). Receives the value at the clicked position as argument.

Methods

getValue

Returns the current value of the slider, which is a number in the case of a single slider, or an array of numbers in case of a multi slider.

License

See the License file.