# rc-ruler

> ruler component for react

Latest version **0.1.1** (published 2019-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install rc-ruler
pnpm add rc-ruler
yarn add rc-ruler
bun add rc-ruler
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-01-02 |
| First published | 2019-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 636.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18 |
| Author | YanYuanFE |
| Maintainers | yanyuanfe |
| Keywords | react, react-component, ruler, rxjs |

## Links

- npm: https://www.npmjs.com/package/rc-ruler
- Repository: https://github.com/YanYuanFE/react-ruler
- Issues: https://github.com/YanYuanFE/react-ruler/issues
- npm.io page: https://npm.io/package/rc-ruler

## Dependencies (2)

- [rxjs](https://npm.io/package/rxjs.md) ^5.5.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.6.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

- 0.1.1 (latest) — 2019-01-02
- 0.1.0 — 2019-01-02

## README

# rc-ruler

> Ruler component for React

# Why

![设计稿](./src/assets/ui.png "设计稿")

*为了实现上面的设计，折腾了一个这样的轮子。*

### 效果如下
![效果](./src/assets/result.png "效果")

* 仅支持PC端
* 支持拖拽、点击来选择相应的值
* 可以和Ant-Design的Form结合
* 依赖rxjs处理事件(按需加载)



## Install

```bash
npm install rc-ruler --save
```

## Usage

``` js
import Ruler from 'rc-ruler';
import 'rc-ruler/dist/index.css';
```

``` js
handleDragChange = (value) => {
   console.log(value);
}

<Ruler
   value={value}
   onDrag={this.handleDragChange}
   start={20}
   end={99}
   step={2}
/>
```

## Proptypes

```js
   propTypes: {

      // current value
      value: PropTypes.number,

      // start value
      start: PropTypes.number,

      // end value
      end: PropTypes.number,

      // step of drag
      step: PropTypes.number,

      // handle drag function
      onDrag: PropTypes.func,

      // class of component
      className: PropTypes.string,
   }
```


## License

[MIT][mit-license]

[mit-license]: ./LICENSE

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