1.3.1 • Published 7 years ago

circular-slider v1.3.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

circular-slider

React component to drag a point along a circular path

Installation

npm install circular-slider --save

Example

import React from 'react';
import { CircularSlider } from 'circular-slider';

class MyFancyGauge extends React.Component {
  state = {
    angle: 0
  }
  render() {
    return (
      <CircularSlider
        angle={this.state.angle}
        onMove={angle => this.setState({ angle })}
      />
    );
  }
}

Options

PropTypeDefaultDescription
angleNumber200Current angle of handle
arcEndNumber360Angle of end of optional arc
arcStartNumber180Angle of start of optional arc
colorStringdarkseagreenColor of handle (and optional needle & arc)
onMoveFunction() => {}Handler function (takes new angle as sole argument)
rNumber100Radius of the path the slider follows
showArcBooleanfalseRenders a circular arc
showNeedleBooleantrueRenders a line from center to handle

Note: Angles are measured in degrees, clockwise from the positive x-axis.