all templates
Web Basics

Star Rating

Hover to preview, click to choose — a real interactive widget.

Five stars that light up as you hover and lock in when you click. You'll learn the difference between a temporary hover state and committed state, and how to keep it keyboard-friendly.

What's inside

  • Hover preview vs. selected value
  • Keyboard support with the arrow keys
  • Each star is a real, labelled button
  • Remembers your last rating
  • Light & dark mode, no dependencies

Quickstart

$ curl -LO https://devai.io/downloads/star-rating.zip$ unzip star-rating.zip && cd star-rating$ open index.html   # or just double-click the file

Browse the code

The full source, exactly as the zip ships it.

loading…
Download .zip
loading tree…

about this tutorial

A devai.io starter tutorial — building an interactive widget with two kinds of state.