Giter VIP home page Giter VIP logo

rc-range-slider's Introduction

React Range Slider

npm version js-standard-style rc-range-slider GitHub license

NPM

A tooltip component for react.

Screenshot

rc-range-slider

Live demo

Click here: https://ecmadao.github.io/rc-range-slider

Install

$ npm i rc-range-slider --save

Build config

  • Webpack 3.x config example
// webpack config file

// loaders
const postcssLoader = {
  loader: 'postcss-loader',
  options: {
    config: {
      path: path.join(__dirname, 'postcss.config.js')
    }
  }
};
const cssModulesLoader = ExtractTextPlugin.extract({
  fallback: 'style-loader',
  use: [
    {
      loader: 'css-loader',
      options: {
        modules: true,
        sourceMaps: true,
        importLoaders: 1,
        localIdentName: '[name]__[local]___[hash:base64:5]'
      }
    },
    postcssLoader
  ],
});

const webpackConfig = {
  module: {
    rules: [
      {
        test: /\.css$/,
        include: /rc-range-slider|rc-tipso/,
        loaders: cssModulesLoader
      }
    ]
  }
};
  • Webpack 1.x config example
const webpackConfig = {
  module: {
    loaders: [
      {
        test: /\.css$/,
        include: /rc-range-slider|rc-tipso/,
        loaders: cssLoaders
      }
    ]
  },
  postcss: () => {
    return [
      require('postcss-cssnext')
    ]
  }
};

Usage

import Slider from 'rc-range-slider';

// ...

render() {
  return (
    <Slider value={[15, 35]} minRange={5}/>
  )
}

Example

Click here to see tipso usage examples.

Api

name type default description
tipFormatter PropTypes.func null A function to custom tooltip value. Should return a string or DOM.
min PropTypes.number 0 Slider min value.
max PropTypes.number 100 Slider max value.
value PropTypes.number or PropTypes.array 10 When it be a number, Slider will render single range select. Or pass a array to support multi range select.
minRange PropTypes.number 1 The minimum range value between two pickers.
jump PropTypes.bool false When you are dragging the picker, jump decide to update the value by using jumpRange. Besides, section points will rendered by sectionRange.
jumpRange PropTypes.number 1 The minimum value to change, should work with jump props.
sectionRange PropTypes.number or PropTypes.array null The section range to render the section point.
clickable PropTypes.bool false Whether the row can be clicked or not.
updateWhenDrag PropTypes.bool false In default config, you will receive onChange callback after drag finished. But by setting updateWhenDrag to true, you can get callback as soon as value changed when dragging.
onChange PropTypes.func () => {} The callback when value changed.

Custom style

name type default description
className PropTypes.string '' Custom className to change UI.
draggerClass PropTypes.string '' Custom dragger style
tipsoClass PropTypes.string '' Custom tip style
pathwayClass PropTypes.string '' Custom pathway style
color PropTypes.string green Theme color. Support green, dark, blue, red, gray
useTipso PropTypes.bool true Whether use tip or not when hover picker.

Dev

$ git clone [email protected]:ecmadao/rc-range-slider.git
$ cd rc-range-slider
$ npm i
$ npm run storybook

License

Released under MIT License

rc-range-slider's People

Contributors

ecmadao avatar dancerphil avatar shianqi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.