npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-canvas-knob

v0.5.0

Published

HTML5 Canvas-based React knob/dial component

Downloads

383

Readme

react-canvas-knob

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.

import React from 'react';
import Knob from 'react-canvas-knob';

class MyComponent extends React.Component {
  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| |className|custom className to be applied to the container element|null| |canvasClassName|custom className to be applied to the canvas element|null|

Contributing

  • Make changes to Knob.js, then run npm run babel to transpile.

Todo

  • [ ] Fix for height > width condition
  • [ ] Port displayPrevious feature
  • [ ] Downwards compatibility
  • [ ] Implement some of the existing pull requests
  • [ ] Improve manual text input