Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-input-range
Advanced tools
InputRange
is a React component allowing users to input a numeric value within a predefined range. It can accept a single value, or a range of values (start/end). 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. npm install react-input-range
react-input-range
to use InputRange
component.react-input-range.css
if you want to apply the default styling.babel-core/polyfill
or core-js/es6
polyfill might be needed.If accepting a range of values:
import React from 'react';
import InputRange from 'react-input-range';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
values: {
min: 2,
max: 10,
},
};
}
handleValuesChange(component, values) {
this.setState({
values: values,
});
}
render() {
return (
<InputRange
maxValue={20}
minValue={0}
values={this.state.values}
onChange={this.handleValuesChange.bind(this)}
/>
);
}
}
React.render(
<App />,
document.getElementById('app')
);
If accepting a single value, use value
prop instead of values
, i.e.:
<InputRange
maxValue={20}
minValue={0}
value={this.state.value}
onChange={this.handleValueChange.bind(this)}
/>
Property | Type | Description |
---|---|---|
ariaLabelledby | string | aria-labelledby attribute |
classNames | Object.<string> | CSS class names |
defaultValue | number | Default value |
defaultValues | Object | Default values |
disabled | boolean | Disabled or not |
maxValue | number | Maximum value it can accept |
minValue | number | Minimum value it can accept |
name | string | Name of form input |
onChange | Function | onChange callback |
step | number | Increment/decrement value |
value | number | Current value |
values | Object | Current range of values |
If you want to work on this project locally, you need to grab all of its dependencies.
npm install && bundle install
After that, you should be able run
npm start
Contributions are welcome. :)
FAQs
React component for inputting numeric values within a range
The npm package react-input-range receives a total of 35,544 weekly downloads. As such, react-input-range popularity was classified as popular.
We found that react-input-range demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.