6.0.1 • Published 3 years ago

react-input-slider v6.0.1

Weekly downloads
24,677
License
MIT
Repository
github
Last release
3 years ago

react-input-slider

npm npm Build Status codecov styled with prettier

React slider component

Installation

yarn add react-input-slider
npm install react-input-slider --save

Storybook Demo

http://react-input-slider.caitouyun.com

Usage

import React from 'react';
import Slider from 'react-input-slider';

function App() {
  const [state, setState] = useState({ x: 10, y: 10 });

  return (
    <div>
      ({state.x}, {state.y})
      <Slider axis="xy" x={state.x} y={state.y} onChange={setState} />
      <Slider
        axis="x"
        x={state.x}
        onChange={({ x }) => setState(state => ({ ...state, x }))}
      />
      <Slider axis="y" y={state.y} onChange={({ y }) => setState(state => ({ ...state, y }))} />
    </div>
  );
}

Styling

v5 introduces a new styling api powered by emotion

<Slider
  styles={{
    track: {
      backgroundColor: 'blue'
    },
    active: {
      backgroundColor: 'red'
    },
    thumb: {
      width: 50,
      height: 50
    },
    disabled: {
      opacity: 0.5
    }
  }}
/>

Props

NameTypeDescriptionDefault
axisstringtype of slider ('x', 'y', 'xy')'x'
xnumbervalue of x50
xmaxnumbermax of x100
xminnumbermin of x0
ynumbervalue of y50
ymaxnumbermax of y100
yminnumbermin of y0
xstepnumberstep of x1
ystepnumberstep of y1
onChangefunctionhandleChangenull
onDragStartfunctionhandleDragStartnull
onDragEndfunctionhandleDragEndnull
disabledbooleaninput disabledfalse
xreversebooleanreverse on xfalse
yreversebooleanreverse on yfalse

License

MIT

6.0.1

3 years ago

6.0.0

4 years ago

5.1.7

4 years ago

5.1.6

4 years ago

5.1.5

4 years ago

5.1.4

4 years ago

5.1.3

5 years ago

5.1.2

5 years ago

5.1.1

5 years ago

5.1.0

5 years ago

5.0.16

5 years ago

5.0.15

5 years ago

5.0.14

5 years ago

5.0.13

5 years ago

5.0.12

5 years ago

5.0.10

5 years ago

5.0.9

5 years ago

5.0.8

5 years ago

5.0.7

5 years ago

5.0.6

5 years ago

5.0.5

5 years ago

5.0.4

5 years ago

5.0.3

5 years ago

5.0.2

5 years ago

5.0.1

5 years ago

5.0.0

5 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.0.0

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.6.0

7 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.3.1

8 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago