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

reactrangeslider

v3.0.6

Published

A range slider component for React.

Downloads

602

Readme

React Sliders

An collection of elegant slider components for React. Demo Page.

Installing

The library is available as npm package.

npm install reactrangeslider

Using The component

The component is easy to use. Import the library and add the component to your JSX:

import React from 'react';
import Slider from 'range-sliders';

const MyPage = () =>
  <div>
    <Slider />
  </div>;

Small cart in header

An example of uncontrolled slider with single handle, defaultValue and step passed in props:

import React from 'react';
import RangeSlider from 'reactrangeslider';

const MyPage = () =>
  <div>
    <Slider defaultValue={20} step={ 5 } />
  </div>;

An example of controlled range slider with two handles, value and step passed in props:

import React from 'react';
import RangeSlider from 'reactrangeslider';

// value={ start: 20, end: 80 }
const MyPage = (value, onChange) =>
  <div>
    <RangeSlider
      value={ value }
      onChange={ onChange }
      min={ 20 }
      max={ 100 }
      step={ 5 }
    />
  </div>;

Check docs for more examples.

List of properties supported

| Option | Description | | ------ | ----------- | | id | id of the root div element | | name | name of the root div element | | min | minimum value in the range | | max | maximum value in the range | | step | amount by which the position of slider will change in one movement | | defaultValue | it is used to initialize uncontrolled components | | value | it is used to set value in a controlled component | | onChange | the function is executed whenever the value changes | | afterChange | the function is executed after the user has stopped moving the slider | | disabled | property used to disable component, disable component can not even receive focus | | readOnly | property used to make component readOnly, it can still be focused | | tabIndex | this is used to set the tabIndex of handles which are moved to change value of slider |

Custom styling

Styling of Range Slider is highly customizable. It supports styling using both inline styles and classes. Internally the libary used inline styles, I have preferred that for ease of installation for users.

If inline styles are used for styling, the inline styles passed to it will override the defaults. If classes are used for styling, you will be required to use !important to override corresponding default inline style.

| Style Property | Description | | ------ | ----------- | | wrapperStyle | style applied to wrapper div element | | trackStyle | style applied to track | | disabledTrackStyle | style applied to track of disabled component | | highlightedTrackStyle | style applied to highlighted track | | disabledHighlightedTrackStyle | style applied to highlighted track of disabled component | | handleStyle | style applied to handle | | focusedHandleStyle | style applied to focused handle | | hoveredHandleStyle | style applied to hovered handle | | activeHandleStyle | style applied to active handle | | disabledHandleStyle | style applied to disabled handle |

| Class Name | Description | | ------ | ----------- | | wrapperClassName | class applied to wrapper div element | | handleClassName / disabledHandleClassName | either of these classes is applied to the handle depending on whether its enabled or disabled | | trackClassName / highlightedTrackClassName | either of these classes is applied to the track depending on whether its enabled or disabled | | highlightedTrackClassName / disabledHighlightedTrackClassName | either of these classes is applied to the highlighted handle depending on whether its enabled or disabled | Styles applied to highlighted track are applicable only to Reage Slider with two handles and highlighted area between them.

Device support

Range Slider is responsive to different sizes and resolutions. Its responsive to mouse, keyboard and touch events.

Future plans

Making it a complete range of slider components with addition of components like vertical slider, vertical range slider, etc motivation.

License

MIT.