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-range-slider-bem

v0.2.11

Published

Fork of 'react-range-slider' with BEM naming

Downloads

13

Readme

React Range Slider BEM

NPM DEPS TRAVIS

A flexible slider for reactjs

Demo

Getting Started

Install via npm

NPM

Usage

import RangeSlider from 'react-range-slider-bem';

// ...
render() {
    return (
        <RangeSlider value={[20]} withBars />
    );
}

Options

min

Type: Number
Default: 0
Description: Min value for slider, default is 0.

// ...
render() {
    return (
        <RangeSlider min={0} />
    );
}

max

Type: Number
Default: 100
Description: Max value for slider, default is 100.

// ...
render() {
    return (
        <RangeSlider max={999} />
    );
}

value

Type:

value: PropTypes.oneOfType([
    PropTypes.number,
    PropTypes.oneOfType([
        PropTypes.arrayOf(PropTypes.number),
        PropTypes.arrayOf(PropTypes.string),
        PropTypes.arrayOf(PropTypes.shape({
            value: PropTypes.number,
            color: PropTypes.string,
        })),
    ]),
])

Default: []
Description: Define the value, can be string or array

// ...
render() {
    return (
        <div>
            <RangeSlider value=[10,20] />
            or
            <RangeSlider value=[{value:10, color: '#FFF'}] />
            or
            <RangeSlider value=['#FFF', '#FFS'] />
        </div>
    );
}

orientation

Type: PropTypes.oneOf(['horizontal', 'vertical'])
Default: horizontal
Description: Orientation for slider, must be horizontal or vertical, default is horizontal.

// ...
render() {
    return (
        <RangeSlider orientation="vertical" />
    );
}

withBars

Type: Boolean
Default: false
Description: Options is slider show the bars or not, default false.

cursor

Type: Boolean
Default: false
Description: Options is slider show the cursors or not, default false. You can also set up a custom cursor and implement like ./Cursor.js

disabled

Type: Boolean
Default: false
Description: Options disable slider, default false. If set diabled with true cursors in the slider will unable to drag.

range

Type:

range: PropTypes.oneOfType([
    PropTypes.bool,
    PropTypes.arrayOf(PropTypes.bool),
    PropTypes.arrayOf(PropTypes.number),
])

Description: Range for slider, menas you can set header or tailer cursor or both, something like blow: -|-----------|-

// ...
render() {
    return (
        <div>
            <RangeSlider range />
            or
            <RangeSlider range={[true, false]} />
            or
            <RangeSlider range={[10, 90]} />
        </div>
    );
}

disabledHeader

Type: Boolean
Description: Disable slider header cursor.

// ...
render() {
    return (
        <RangeSlider range={[10]} disabledHeader />
    );
}

disabledTailer

Type: Boolean
Description: Disable slider tailer cursor.

// ...
render() {
    return (
        <RangeSlider range={[null, 90]} disabledTailer />
    );
}

className

Type: String
Default: range-slider
Description: Slider classname

// ...
render() {
    return (
        <RangeSlider className="custom-slider" />
    );
}

modClassName

Type: String
Description: Slider modifier classname

// ...
render() {
    return (
        <RangeSlider className="custom-slider" modClassName="rating" />
    );
}

It will transform to custom-slider_rating on root element

onMouseDown

Type: Function
Default: function noop() {}
Description: Hook event for when mouse down for each cursor.

// ...
render() {
    return (
        <RangeSlider onMouseDown={somefunction} />
    );
}

onBeforeChange

Type: Function
Default: function noop() {}
Description: Hook function before cursor dragging

onChange

Type: Function
Default: function noop() {}
Description: Hook function when cursor dragging

onAfterChange

Type: Function
Default: function noop() {}
Description: Hook function after cursor dragging

onBarClick

Type: Function
Default: function noop() {}
Description: Click event for each bar

/**
 * @param {Object} Event click event instance.
 * @param {Number} Index Index of the clicked bar.
 * @param {String} Color Clicked bar's background color.
 */
// ...
render() {
    return (
        <RangeSlider onBarClick={somefunction(evt[, index, color])} />
    );
}

License

MIT © Anton Kuznetsov