Gathering detailed insights and metrics for react-input-range
Gathering detailed insights and metrics for react-input-range
Gathering detailed insights and metrics for react-input-range
Gathering detailed insights and metrics for react-input-range
React component for inputting numeric values within a range (range slider)
npm install react-input-range
Typescript
Module System
Node Version
NPM Version
94.3
Supply Chain
95.5
Quality
75.4
Maintenance
100
Vulnerability
100
License
JavaScript (92.71%)
CSS (6.46%)
HTML (0.83%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
714 Stars
191 Commits
238 Forks
6 Watchers
19 Branches
18 Contributors
Updated on Mar 12, 2025
Latest Version
1.3.0
Package Id
react-input-range@1.3.0
Size
195.85 kB
NPM Version
4.1.1
Node Version
6.9.4
Published on
Jan 06, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
49
InputRange
is a React component allowing users to input numeric values within a specific range. It can accept a single value, or a range of values (min/max). By default, basic styles are applied, but can be overridden depending on your design requirements.
A CodePen demo is available here.
react-input-range
using npm (or yarn). npm install react-input-range
react-input-range
to use InputRange
component.react-input-range/lib/css/index.css
if you want to apply the default styling.To accept min/max value:
1import React from 'react'; 2import ReactDOM from 'react-dom'; 3import InputRange from 'react-input-range'; 4 5class App extends React.Component { 6 constructor(props) { 7 super(props); 8 9 this.state = { 10 value: { min: 2, max: 10 }, 11 }; 12 } 13 14 render() { 15 return ( 16 <InputRange 17 maxValue={20} 18 minValue={0} 19 value={this.state.value} 20 onChange={value => this.setState({ value })} /> 21 ); 22 } 23} 24 25ReactDOM.render( 26 <App />, 27 document.getElementById('app') 28);
To accept a single value:
1class App extends React.Component { 2 constructor(props) { 3 super(props); 4 5 this.state = { value: 10 }; 6 } 7 8 render() { 9 return ( 10 <InputRange 11 maxValue={20} 12 minValue={0} 13 value={this.state.value} 14 onChange={value => this.setState({ value })} /> 15 ); 16 } 17}
To format labels:
1<InputRange 2 formatLabel={value => `${value}cm`} 3 value={this.state.value} 4 onChange={value => this.setState({ value })} />
To specify the amount of increment/decrement
1<InputRange 2 step={2} 3 value={this.state.value} 4 onChange={value => this.setState({ value })} />
Set to true
to allow minValue
and maxValue
to be the same.
Set aria-labelledby
attribute to your component.
Set aria-controls
attribute to your component.
Override the default CSS classes applied to your component and its sub-components.
If this property is set to true, your component is disabled. This means you'll not able to interact with it.
If this property is set to true, you can drag the entire track.
By default, value labels are displayed as plain numbers. If you want to change the display, you can do so by passing in a function. The function can return something different, i.e.: append a unit, reduce the precision of a number.
Set a maximum value for your component. You cannot drag your slider beyond this value.
Set a minimum value for your component. You cannot drag your slider under this value.
Set a name for your form component.
Whenever your user interacts with your component (i.e.: dragging a slider), this function gets called. Inside the function, you should assign the new value to your component.
Whenever your user starts interacting with your component (i.e.: onMouseDown
, or onTouchStart
), this function gets called.
Every mouse / touch event can trigger multiple updates, therefore causing onChange
callback to fire multiple times. On the other hand, onChangeComplete
callback only gets called when the user stops dragging.
The default increment/decrement of your component is 1. You can change that by setting a different number to this property.
Set the current value for your component. If only a single number is provided, only a single slider will get rendered. If a range object (min/max) is provided, two sliders will get rendered
If you want to work on this project locally, you need to grab all of its dependencies, for which we recommend using yarn. You can find the instructions to setup yarn here.
yarn install
After that, you should be able run to preview
yarn dev
To test
yarn test
Contributions are welcome. :)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
160 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More