04.26 · Micro-Interactions

Star Rating

Stars fill up to your pointer and pop when you choose. Best for reviews.

Click it

Point along the stars and click or tap one to choose, or press Show me.

3.0 / 5

Try it

Change a setting, then try it again or press Show me.

Pop size

How much the chosen star grows as it pops.

Speed

How quickly each star fills with color.

The left half of a star gives half a point.

More optionsFewer options

Number of stars

Five is the usual scale; ten gives finer steps.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add a star rating to [the review or feedback form]. As the pointer moves along the row, fill the stars up to the one under it so the choice shows before it is made, and bring back the chosen rating when the pointer leaves. Clicking or tapping a star chooses that rating and makes the star pop: it grows briefly, dips a little below its size and settles. On touch screens, a finger dragged along the row previews too. Make the row one control that the arrow keys can change, and show the rating as a number as well, so it never depends on color alone. If the visitor has reduced motion turned on, fill the stars without the pop. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Reviews
  • Surveys
  • Feedback forms
  • Media ratings

Avoid on

  • Precise scores