React Hooks Rate Component
Branch: master
Clone or download
Latest commit 379c824 Feb 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
build react rating package Feb 10, 2019
examples/src 📦 Refactoring Feb 10, 2019
src 📦 Refactoring Feb 10, 2019
.babelrc react rating package Feb 10, 2019
.gitignore react rating package Feb 10, 2019
.npmignore react rating package Feb 10, 2019
README.md changed readme Feb 10, 2019
demo.png readme added Feb 10, 2019
package-lock.json 📦 Refactoring Feb 10, 2019
package.json readme added Feb 10, 2019
webpack.config.js react rating package Feb 10, 2019

README.md

react-rate-component

React Hooks Rate Component

npm version

Demo

React Rate Component - Demo

Install

    npm install react-rate-component --save

Usage

import ReactRateComponent 'react-rate-component'

class Foo extends Component {
    changeRating(newRating) {
      setRate(newRating)
    }

    render() {
      return (
        <ReactRateComponent
            defaultValue={3}
            showCount={true}
            onChange={this.changeRating}
        />
      );
    }
}

class Bar extends Component {
  render() {
    return (
        <ReactRateComponent />
    );
  }
}

Properties

Property Description Default value Type
count Total symbol count 5 number
edit You can make disable your rate symbols true boolean
showCount Set rating value false boolean
defaultValue Set rating default value 0 number
symbol Which character you want to use string
size Size of symbol (px) 25px string
activeColor Color of selected or active symbols #ffd700 string
inactiveColor Color of inactive symbols #949494 string

Callbacks

Callback Description Type
onChange(new_rating) Will be invoked any time the rating is changed function (value) {}

Todo

  • Write tests

License MIT