Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including react-component-range with all npm packages installed. Try it out:

require("react/package.json"); // react is a peer dependency. require("react-dom/package.json"); // react-dom is a peer dependency. var reactComponentRange = require("react-component-range")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-component-range v1.0.0

React Component Range is a simple and minimal React input range component

react-component-range

npm version Build Status

React Component Range is a simple and minimal React input range component

Install

npm install react-component-range

Usage

import React, { Component } from "react";
import ReactRange from "react-component-range";

class App extends Component {
  onChange = value => {
    console.debug("Value: ", value);
  };

  render() {
    return (
      <ReactRange
        min={0}
        max={100}
        defaultValue={50}
        ariaLabel="Slider to adjust the volume"
        onChange={this.onChange}
      />
    );
  }
}

export default App;

Props

NameTypeDefaultDescription
idstringThe id of the input (range)
namestringThe input's name, to identify the input in the data submitted with the form's data
minnumber0The minimum permitted value
maxnumber100The maximum permitted value
stepnumber1The stepping interval, used both for user interface and validation purposes
onChangefunction() => {}The callback action to be performed when the value changes. It returns the current value.
valuenumberThe input's current value
defaultValuenumber0The input's initial value
ariaLabelstringThe accesibility aria-label property of the input
ariaLabelledbystringThe accesibility aria-labelledby property of the input
disabledbooleanfalseA Boolean attribute which is present if the input should be disabled
requiredbolleanfalseA Boolean which, if true, indicates that the input must have a value before the form can be submitted
tabIndexnumberA numeric value providing guidance to the user agent as to the order in which controls receive focus when the user presses the Tab key

Contributing

Feel free to submit issues and enhancement requests.

Please refer to each project's style guidelines and guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.

  1. Fork the repo on GitHub
  2. Clone the project to your own machine
  3. Commit changes to your own branch
  4. Push your work back up to your fork
  5. Submit a Pull request so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request!

Future actions

  • Typescript component
  • Write tests for the component
  • Personalization (color and size)
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free