ekeric13 / react-star-ratings

A customizable svg star rating component for selecting x stars or visualizing x stars
https://codepen.io/ekeric13/project/full/DkJYpA/
BSD 3-Clause "New" or "Revised" License
152 stars 44 forks source link

Add formatted tooltip text #40

Open jaycincotta opened 4 years ago

jaycincotta commented 4 years ago

Specifying typeOfWidget is insufficient. For example, I'm using this with election software and would like tooltips such as:

John Smith received an average rating of 4.5 stars among 1000 voters

In addition, the current implementation of titleText makes an assumption that typeOfWidget is a noun that can be pluralized by adding an 's'. This won't work in all cases. For example, the plural of "Cherry" is "Cherries"

The tooltip needs to be calculated dynamically. I suggest adding a new property that accepts a function:

tooltipFormater: is passed the current star rating and returns a string.

fabinca commented 1 year ago

I'll work on this