# react-canvas-uiknob

> HTML5 Canvas-based React knob/dial component

Latest version **1.0.2** (published 2017-10-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-canvas-uiknob
pnpm add react-canvas-uiknob
yarn add react-canvas-uiknob
bun add react-canvas-uiknob
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-10-30 |
| First published | 2017-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Author | Joshua Goldman |
| Maintainers | dineshelango |
| Keywords | react, canvas, knob, dial, control |

## Links

- npm: https://www.npmjs.com/package/react-canvas-uiknob
- Repository: https://github.com/joshjg/react-canvas-knob
- Homepage: https://github.com/joshjg/react-canvas-knob#readme
- Issues: https://github.com/joshjg/react-canvas-knob
- npm.io page: https://npm.io/package/react-canvas-uiknob

## 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

- 1.0.2 (latest) — 2017-10-30
- 1.0.1 — 2017-10-30
- 1.0.0 — 2017-10-30

## README

# react-canvas-knob

[jQuery Knob](https://github.com/aterrien/jQuery-Knob) rebuilt with React (no jQuery). This is an HTML5 Canvas-based component that serves as a circular range input. Accepts mouse, touch, scrollwheel, and keyboard input.

## Installation
`npm install react-canvas-knob --save`

## Example usage
Please note that react-canvas-knob must be used as a [controlled input](https://facebook.github.io/react/docs/forms.html#controlled-components).
```js
import React from 'react';
import Knob from 'react-canvas-knob';

class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {value: 50};
  }
  handleChange = (newValue) => {
    this.setState({value: newValue});
  };
  render() {
    return (
      <Knob
        value={this.state.value}
        onChange={this.handleChange}
      />
    );
  }
}
```

## Properties
| name | description | default |
|------|-------------|---------|
|`value`|numeric value of knob|n/a|
|`onChange`|function to be called on user input with the current numerical value|n/a|
|`onChangeEnd`|function to be called on mouseUp or touchEnd with the current numerical value|n/a|
|`min`|min value|`0`|
|`max`|max value|`100`|
|`step`|step size|`1`|
|`log`|enable logarithmic scale (must use non-zero `min` and `max`, `step` > 1)|`false`|
|`width` or `height`|dimension of square (px)|`200`|
|`thickness`|gauge thickness|`0.35`|
|`lineCap`|gauge stroke ending style (`butt` or `round`)|`'butt'`|
|`bgColor`|background color|`'#EEE'`|
|`fgColor`|foreground color|`'#EA2'`|
|`inputColor`|text color|`fgColor`|
|`font`|font family|`'Arial'`|
|`fontWeight`|font weight|`'bold'`|
|`clockwise`|direction of progression|`true`|
|`cursor`|use cursor display mode - give width value or `true` which uses the default cursor width (30)|`false`|
|`stopper`|stop at min & max on keydown/mousewheel|`true`|
|`readOnly`|disable all user input|`false`|
|`disableTextInput`|disable manual text input only|`false`|
|`displayInput`|show numeric input box|`true`|
|`displayCustom`|function that will render your custom component in the centre. (Make sure to set `displayInput` as `false`, as that takes priority)|n/a|
|`angleArc`|arc size in degrees|`360`|
|`angleOffset`|starting angle in degrees|`0`|
|`disableMouseWheel`|disable changes on mouse wheel use|`false`|
|`title`|adds title attribute to the wheel|`value`|

## Todo
- [ ] Fix for height > width condition
- [ ] Port `displayPrevious` feature
- [ ] Downwards compatibility
- [ ] Implement some of the existing [pull requests](https://github.com/aterrien/jQuery-Knob/pulls)
- [ ] Improve manual text input

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