Loading problem…
Build an interactive Star Rating component — one of the most common UI elements in e-commerce, review systems, and feedback forms.
Create a StarRating component that allows users to select a rating by clicking on stars and see a hover preview before committing.
<button> (not a <div> or <span>)aria-label on each star button (e.g., "Rate 3 out of 5 stars")// Default 5 stars
<StarRating />
// Custom star count
<StarRating maxStars={10} />
## Real-World Context
This problem models real production features:
- **Product reviews**: Amazon, Yelp, Google Maps rating systems
- **Feedback forms**: NPS scores, satisfaction surveys
- **Content ratings**: Movie/book/restaurant ratings
- **Skill assessments**: Self-evaluation forms in HR tools