Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-input-range-vertical

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-range-vertical

React component for inputting numeric values within a range, supports vertical sliders

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-input-range

This Module is based on the react-input-range Module (https://www.npmjs.com/package/react-input-range) by David Chin.

I just added the vertical option. Otherwise see the original for usage.

Installation

  1. Install react-input-range-vertical using npm. npm install react-input-range-vertical
  2. Import react-input-range to use InputRange component.
  3. Optionally, import react-input-range.css if you want to apply the default styling.
  4. Depending on your browser support requirement, babel-core/polyfill or core-js/es6 polyfill might be needed.

Usage

If accepting a range of values:

import React from 'react';
import ReactDOM from 'react-dom';
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}
        value={this.state.values}
        onChange={this.handleValuesChange.bind(this)}
      />
    );
  }
}

ReactDOM.render(
  <App />,
  document.getElementById('app')
);

If accepting a single value, pass a number to value prop, i.e.:

<InputRange
  maxValue={20}
  minValue={0}
  value={this.state.value}
  onChange={this.handleValueChange.bind(this)}
/>

For a vertical slider just pass the string "vertical" to the orientation prop, i.e.:

<InputRange
  maxValue={20}
  minValue={0}
  value={this.state.value}
  onChange={this.handleValueChange.bind(this)}
  orientation="vertical"
/>

Options

PropertyTypeDescription
ariaLabelledbystringaria-labelledby attribute
ariaControlsstringaria-controls attribute
classNamesObject.<string>CSS class names
defaultValuenumber | Object.<number>Default value(s)
disabledbooleanDisabled or not
formatLabelFunctionLabel formatter
labelPrefixstringLabel prefix
labelSuffixstringLabel suffix
maxValuenumberMaximum value it can accept
minValuenumberMinimum value it can accept
namestringName of form input
onChangeFunctiononChange callback (required)
onChangeCompleteFunctiononChangeComplete callback
stepnumberIncrement/decrement value
valuenumber | Object.<number>Current value(s) (required)
orientationstringWether the slider is horizontal or vertical

Development

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

Keywords

FAQs

Package last updated on 12 Jul 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc