1.0.4 • Published 7 years ago

react-star-rating-meter v1.0.4

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

react-star-rating-meter

a customizable React star rating component with or without a meter.

examples: https://dahlki.github.io/react-star-rating-meter/

code for the examples can be viewed in the example folder of this repo.


install:

https://www.npmjs.com/package/react-star-rating-meter

npm install --save react-star-rating-meter

or

yarn add react-star-rating-meter

properties:

all properties are optional (properties will revert to default values)

*note: color values can be any css valid color value; if you want a color property to be transparent use an empty string: ""

*note: if using a custom svg, only one 'path' can be given and also, the 'viewBox' value is required.

PropDataTypeDefaultDescription
readOnlybooleanfalseindicate whether the star rating is editable by the user or read only
numOfStarsnumber5number of stars
initialRatingnumber0set initial value
heightnumber (px)30height of the meter and highlight in pixels
lengthnumber (px)250length of the meter in pixels
showMeterbooleantrueindicate whether to show the meter or just show stars/svgs
labelstringStarRatingan option to label the component to easily get and store the rating value
meterEmptyColorstring#F0E7E7set the default/empty meter color
meterSelectColorstring#311E24set the select/active meter color
meterBorderColorstring#785A65set the meter border color
meterBorderSizenumber (px)3set the meter border thickness
meterBorderStylestringsolidset the border style; can be any css valid border style
highlightColorstring#FFD6DDset the highlight color of the selected/active star
highlightWidthnumber (px)30set the width of the highlight (height is determined by the height prop, the height of the meter)
starEmptyColorstring#AF9EA3set the default/empty color of the stars/svgs
starSelectColorstring#D60429set the selected/active color of the stars/svgs
starSizenumber (px)18size of the stars
getRatingfunctionundefinedset a function to be called upon clicking a star; the arguments passed are: (rating, label, event)
onHoverfunctionundefinedset a function to be called upon hovering a star; the arguments passed are: (rating, label, event)
svgobject = {path: string, viewBox: string}(if none indicated, the svg is a star)an object that must have both path and viewBox properties; if either one is missing, defaults to a star
1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago