Socket
Socket
Sign inDemoInstall

react-rangeslider-extended-multiple

Package Overview
Dependencies
22
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-rangeslider-extended-multiple

A lightweight react component that acts as a HTML5 input range slider polyfill and supports customizable segmented position to value mapping


Version published
Weekly downloads
14
Maintainers
1
Install size
6.25 MB
Created
Weekly downloads
 

Readme

Source

React Rangeslider Extended NPM Package

A lightweight responsive react range slider component forked from whoisandie/react-rangeslider.

Install

Install via npm (use --save to include it in your package.json)

$ npm install react-rangeslider-extended-multiple --save

Usage

React Rangeslider is bundled with a single slider component. You can require them in plain old ES5 syntax or import them in ES6 syntax.

...plain old ES5

var React = require('react');
var Slider = require('react-rangeslider-extended');

var Volume = React.createClass({
	getInitialState: function(){
		return {
			value: 10,
		};
	}

	handleChange: function(value) {
		this.setState({
			value: value,
		});
	}

	render: function() {
		return (
			<Slider
        value={value}
        orientation="vertical"
        onChange={this.handleChange} />
		);
	}
});

module.exports = Volume;

... or use ES6 syntax

import React, { Component } from 'react';
import Slider from 'react-rangeslider-extended';

export default Volume extends Component {
  constructor(props, context) {
    super(props, context);
    this.state = {
      value: 10 /** Start value **/
    };
  }

  handleChange(value) {
    this.setState({
      value: value
    });
  }

  render() {
    return (
      <Slider
        value={value}
        orientation="vertical"
        onChange={this.handleChange} />
    );
  }
}

There's also a umd version available at lib/umd. The component is available on window.ReactRangeslider. To style the slider, please refer the rangeslider styles in demo/demo.less file.

API

Rangeslider is bundled with a single component, that accepts data and callbacks only as props.

Component

import Slider from 'react-rangeslider-extended'

// inside render
<Slider
	min={String or Number}
	max={String or Number}
	step={String or Number}
	orientation={String}
  value={Number}
  onChange={Function}
  onChangeComplete={Function}
  valueMapping={Function} />

Props

PropDefaultDescription
min0minimum value the slider can hold
max100maximum value the slider can hold
step1step in which increments/decrements have to be made
orientationhorizontalorientation of the slider
value-current value of the slider
onChange-function the slider takes, current value of the slider as the first parameter
onChangeComplete-function the slider takes and fires after interaction has ended, current value of the slider as the first parameter
valueMappingdefault funcfunction returning an object that defines segments and toValue and toPos methods to controll position to value (and vice versa) mapping

Issues

Feel free to contribute. Submit a Pull Request or open an issue for further discussion.

License

MIT © whoisandie & Oliver Wehn

Keywords

FAQs

Last updated on 16 Sep 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc