Stars

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/radio-stars

About this component

A five-star rating that is a real radio group. Hovering previews the rating in grey; choosing fills the stars up to it in a quick left-to-right cascade with a springy pop on the one you picked, and a caption says what the score means. Pure CSS with :has().

Triggers

  • Click
  • Hover
  • State change
  • Delay stagger

Techniques

  • Transition delay stagger
  • Keyframes
  • SVG

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

Real native radios (visually hidden: absolute, 1x1, opacity 0) inside <label>s in a role="radiogroup" with an aria-label, so arrow keys, focus and screen readers work. Each radio is labelled "1 star" to "5 stars"; the caption is aria-hidden.

Reduced motion

The changes are instant.

Use it in anything you build, commercial and client work included. Licence

More radios

See all
Tab BarGet code
ThemeGet code
Tip JarGet code
TurntableGet code