0.8.1 • Published 7 years ago

react-motion-slider-input v0.8.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

React-Motion-Slider-Input

A React library/plugin for creating highly customizable input sliders. Uses React-Motion for nice animations.

Install

Make sure React and React-Motion are installed

  • npm install --save react
  • npm install --save react-motion

Install this library

  • npm install --save react-motion-slider-input

Link css to your project from lib/SliderInput.css and create your own styles. Please notice this css is here only for reference. It is highly recommended to create your own styles that match the design of the website or application you are building.

Dependencies

  • React.js (peer dependency)
  • React-Motion (peer dependency)
  • Immutable.js

Usage

import { SliderInput } from 'react-motion-slider-input';

... other code ...

render() {
  return (
    <SliderInput />
  );
}

Properties

NameTypeDefaultDescription
orientationstringhorizontaltoggle between horizontal and vertical orientation
stepnumber1step size
minnumber1minimum value
maxnumber10maximum value
valuenumber1shorthand for setting up one handle with an initial value
rangebool or stringfalseshorthand for setting up a range, set true or below to generate range between min value and handle, set above to generate a range between handle and max value
stepsbool or arrayOf(object)nullset as true to generate steps of size step between values min and max, provide an array of objects of shape { label: string, id: string, value: number or string, className: string} to generate custom steps
handlesarrayOf(object)nullprovide an array of objects of shape {value: number or string, id: string, label: string, className: string}
rangesarrayOf(object)nullprovide an array of objects of shape {id: string, label: string, fromHandle: number, className: string, includeHandles: bool}
onChangefuncundefinedcallback when value changes
onMovefuncundefinedcallback when handle is being moved
disabledboolfalseprevent moving any handles of the slider
classNamestringnulldefine a root class for the slider element for custom css styling
springobject{ stiffness: 1000, damping: 40, precision: 0.01}override react-motion spring config
detailedValueboolfalsereturn a detailed data object in onChange for simple single-value sliders to enable consistent behaviour with complex sliders that return a detailed value automatically

Examples

See example folder.

FAQ

Q: A slider plugin, U serious?

A: We figured world desperately needs yet another slider plugin. I mean, there are barely 5 for React already. That's way too few. Seriously though, this slider tries to provide some functionality that we felt is missing from the others.

Q: It looks ugly. Why?

A: The idea is to include as little forced styles as possible to make it possible for you to create your own styles.

Q: Why no tests?

A: No good reason, we should definitely have some before developing this thing any further.

0.8.1

7 years ago

0.8.0

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago