Giter Club home page Giter Club logo

react-slideruler's Introduction

SlideRuler

SlideRuler component for ReactJS

npm npm npm

example

Getting Started

Install

yarn add slide-ruler --dev

Usage Example

import React from 'react';
import SlideRuler from 'slide-ruler';

class IndexPage extends React.Component {

  constructor() {
    super();

    this.state = {
      currentValue: 0
    };

    this.getCurrentValue = this.getCurrentValue.bind(this);
  }

  getCurrentValue(currentValue){
    this.setState({
      currentValue:currentValue
    })
  }

  render() {
    return (
      <div>
        <p>{this.state.currentValue}</p>
        <SlideRuler getCurrentValue={this.getCurrentValue}
                    maxValue={200}
                    minValue={20}
                    divide={5}
                    precision={0.1}/>
      </div>
    );
  }
}

export default IndexPage;

PropTypes

Property Type Default Description
getCurrentValue Function get the return value
containerWidth Nubmer screen width container width
canvasHeight Nubmer 83 container height
heightDecimal Nubmer 35 scale marks length
heightDigit Nubmer 18 division marks length
lineWidth Nubmer 2 marks width
colorDecimal String #909090 scale marks color
colorDigit String #b4b4b4 division marks color
divide Nubmer 10 division length of px
precision Nubmer 1 division value
fontSize Nubmer 20 scale fontSize
fontColor String #666666 scale fontColor
maxValue Nubmer 230 max value
minValue Nubmer 100 min value
currentValue Nubmer 0 current value

How to Contribute

Anyone and everyone is welcome to contribute to this project. The best way to start is by checking our open issues,submit a new issues or feature request, participate in discussions, upvote or downvote the issues you like or dislike.

License

The MIT License.

react-slideruler's People

Contributors

wusb avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.