Back to components
ElementFormFree

Rating Stars React component

An animated star rating input with half-star precision, keyboard support, a dynamic color range, and an optional progress bar.

About the Rating Stars component

Rating Stars is an animated star rating that works as an input or as a read-only display. It supports half stars, a color range that shifts from red through yellow to green with the score, an optional glow, and a label showing the score as a number, fraction, percentage or word, with an optional review count and progress bar.

As an input it is keyboard accessible: arrow keys change the rating in steps of one or a half, Home and End go to the ends. Size presets from xs to xl, the number of stars and all colors are props.

When to use it

Use it as an input in review and feedback forms, and read-only to show average ratings on product cards, testimonials and review summaries.

Installation

Add the Rating Stars component to your project with the shadcn CLI. It lands in components/rating-stars.tsx as plain React + Tailwind CSS source you own and can edit.

Install
Copied!
npx shadcn@latest add @reactframe/rating-stars

Or copy the source by hand and install its dependencies:

Install
Copied!
npm install motion clsx tailwind-merge

Related components

Animated Checkbox
Free
Toggle Pro
Free
Radio Button
Free
Select
Free
Inline Validation Message
Free
Status Dot
Free