0.1.4 • Published 6 years ago

react-time-knob v0.1.4

Weekly downloads
10
License
MIT
Repository
github
Last release
6 years ago

react-time-knob

jQuery Knob rebuilt with React (no jQuery). This is an HTML5 Canvas-based component that serves as a circular time display with three rings to display the hours, seconds, and minutes given in its props.

Installation

npm install react-time-knob --save

Example usage

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

class MyComponent extends React.Component {
  state = {hours: 1, minutes: 24, seconds: 14};
  render() {
    return (
      <Knob
        hours={this.state.hours}
        minutes={this.state.minutes}
        seconds={this.state.seconds}
      />
    );
  }
}

Properties

namedescriptiondefault
hourshours to display0
minutesminutes to display0
secondsseconds to display0
width or heightdimension of square (px)200
thicknessgauge thickness in percent of width0.35
lineCapgauge stroke ending style (butt or round)'butt'
bgColorbackground color'#EEE'
sColorsecond ring color'#EA2'
mColorminute ring color'#EA2'
hColorhour ring color'#EA2'
inputColortext colorfgColor
fontfont family'Arial'
fontWeightfont weight'bold'
clockwisedirection of progressiontrue
cursoruse cursor display mode - give width value or true which uses the default cursor width (30)false
displayCustomfunction that will render your custom component in the centre. (Make sure to set displayInput as false, as that takes priority)n/a
angleArcarc size in degrees360
angleOffsetstarting angle in degrees0
titleadds title attribute to the wheelvalue
classNamecustom className to be applied to the container elementnull
canvasClassNamecustom className to be applied to the canvas elementnull

Contributing

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

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.0

6 years ago