https://github.com/swiftcarrot/react-input-slider
React input slider component
https://github.com/swiftcarrot/react-input-slider
javascript react slider
Last synced: 28 days ago
JSON representation
React input slider component
- Host: GitHub
- URL: https://github.com/swiftcarrot/react-input-slider
- Owner: swiftcarrot
- License: mit
- Created: 2015-03-22T08:49:26.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-05-07T06:39:19.000Z (12 months ago)
- Last Synced: 2024-05-23T03:20:56.587Z (12 months ago)
- Topics: javascript, react, slider
- Language: JavaScript
- Homepage: https://react-input-slider.caitou.org
- Size: 2.12 MB
- Stars: 141
- Watchers: 6
- Forks: 42
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# react-input-slider
[](https://www.npmjs.com/package/react-input-slider)
[](https://www.npmjs.com/package/react-input-slider)
[](https://travis-ci.org/swiftcarrot/react-input-slider)
[](https://codecov.io/gh/swiftcarrot/react-input-slider)
[](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 (
({state.x}, {state.y})
setState(state => ({ ...state, x }))}
/>
setState(state => ({ ...state, y }))} />
);
}
```### Styling
v5 introduces a new styling api powered by [emotion](https://emotion.sh/)
```javascript
```
### 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