# react-input-slider

> React input slider component

Latest version **6.0.1** (published 2021-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-input-slider
pnpm add react-input-slider
yarn add react-input-slider
bun add react-input-slider
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.1 |
| Published | 2021-06-23 |
| First published | 2015-03-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 38.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 140 |
| Author | Wang Zuo |
| Maintainers | adjusted |
| Keywords | input, react, react-component, slider |

## Links

- npm: https://www.npmjs.com/package/react-input-slider
- Repository: https://github.com/swiftcarrot/react-input-slider
- Homepage: https://swiftcarrot.dev/react-input-slider
- Issues: https://github.com/swiftcarrot/react-input-slider/issues
- npm.io page: https://npm.io/package/react-input-slider

## Dependencies (2)

- [@emotion/core](https://npm.io/package/@emotion/core.md) ^10.0.14
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.9.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 6.0.1 (latest) — 2021-06-23
- 6.0.0 — 2020-07-22
- 5.1.7 — 2020-05-09
- 5.1.6 — 2020-04-08
- 5.1.5 — 2020-04-02
- 5.1.4 — 2019-11-26
- 5.1.3 — 2019-10-03
- 5.1.2 — 2019-08-11
- 5.1.1 — 2019-08-10
- 5.1.0 — 2019-08-10
- 5.0.16 — 2019-07-26
- 5.0.15 — 2019-05-24
- 5.0.14 — 2019-05-16
- 5.0.13 — 2019-05-16
- 5.0.12 — 2019-05-15
- … 36 more at https://npm.io/package/react-input-slider/versions

## README

# react-input-slider

[![npm](https://img.shields.io/npm/v/react-input-slider.svg)](https://www.npmjs.com/package/react-input-slider)
[![npm](https://img.shields.io/npm/dm/react-input-slider.svg)](https://www.npmjs.com/package/react-input-slider)
[![Build Status](https://travis-ci.org/swiftcarrot/react-input-slider.svg?branch=master)](https://travis-ci.org/swiftcarrot/react-input-slider)
[![codecov](https://codecov.io/gh/swiftcarrot/react-input-slider/branch/master/graph/badge.svg)](https://codecov.io/gh/swiftcarrot/react-input-slider)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)

React slider component

### Installation

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

### Storybook Demo

[http://react-input-slider.caitouyun.com](http://react-input-slider.caitouyun.com)

### Usage

```javascript
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](https://emotion.sh/)

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

### Props

| Name        | Type     | Description                           | Default |
| ----------- | -------- | ------------------------------------- | ------- |
| axis        | string   | type of slider (`'x'`, `'y'`, `'xy'`) | `'x'`   |
| x           | number   | value of x                            | `50`    |
| xmax        | number   | max of x                              | `100`   |
| xmin        | number   | min of x                              | `0`     |
| y           | number   | value of y                            | `50`    |
| ymax        | number   | max of y                              | `100`   |
| ymin        | number   | min of y                              | `0`     |
| xstep       | number   | step of x                             | `1`     |
| ystep       | number   | step of y                             | `1`     |
| onChange    | function | handleChange                          | `null`  |
| onDragStart | function | handleDragStart                       | `null`  |
| onDragEnd   | function | handleDragEnd                         | `null`  |
| disabled    | boolean  | input disabled                        | false   |
| xreverse    | boolean  | reverse on x                          | false   |
| yreverse    | boolean  | reverse on y                          | false   |

### License

MIT

---
_Source: https://npm.io/package/react-input-slider · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
