0.0.4 • Published 4 years ago

react-score v0.0.4

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

react-score ✨✨✨✨✨

A react score component for rating

react-score

react-score

Get started quickly

Install react-stars package with NPM:

npm install react-score --save

Then in your project include the component:

import React from 'react'
import ReactScore from 'react-score'

const Score = () => {
  return (
    <ReactScore
      color2='red'
      spacing={15}
      char='H',
      onChange={score => {
        console.log(score)
      }}
    />
  )
}

API

props list:

PropertyDescriptionDefault valuetype
classNameName of parent classnullstring
countHow many total stars you want5number
valueDefault value prop0number
charUse your own character, including svgstring
color1Color of inactive characterrgba(253, 84, 9, 0.2)string
color2Color of selected or active starrgb(253, 84, 9)string
sizeSize of stars (in px)30string
spacingLetter spacing of stars (in px)10string
editShould you be able to select rating or just see rating (for reusability)trueboolean
halfShould component use half stars, if not the decimal part will be dropped otherwise normal algebra rools will apply to round to half starstrueboolean
onChangeWill be invoked any time the rating is changedfunction() {}function

Help improve the component

Build on your machine:
# Clone the repo
https://github.com/cappuccino6/react-score.git
# Go into project folder
cd react-score
# Install dependancies
npm i

Build the component:

npm run build

Run the examples (dev):

npm run dev

Then in your browser go to: http://127.0.0.1:8080/example