Skip to content
Feedback & Data

RatingStars

Stars fill under the pointer as a preview, and a pick runs a small pop along them with a ring off the last one. Works by mouse, touch and arrow keys, with half stars and a read-only mode for averages.

Download
  • React
  • Tailwind CSS v4
  • motion

Props

NameTypeDefaultWhat it does
valuenumberโ€”Current rating. Leave out to let the stars keep their own.
defaultValuenumber0Rating at the start when value is left out.
onChange(value) => voidโ€”Called with the new rating. Picking the same rating again clears it to 0.
maxnumber5Number of stars.
step0.5 | 110.5 lets people pick half stars.
readOnlybooleanfalseOnly shows the rating. Takes any fraction, like 4.3.
sizenumber36One star in pixels.
labelstring"Rating"What the rating is for, read by screen readers.
accentstring"#fbbf24"Filled star colour.
classNamestring"text-white/20"Empty star colour, as a text colour class.