Rating

A star rating built on native radios, so arrow keys, focus and form values work as expected. Hovering previews the score without committing it.

Examples

Basic

Score: 3

Show code
<Rating label="Quality" bind:value={score} />

Read only

Show code
<Rating label="Average score" value={4} readonly />

Props

PropTypeDefaultDescription
valuenumber0Selected score. Bind it with bind:value.
maxnumber5Number of stars.
labelstring"Rating"Accessible name for the radiogroup.
readonlybooleanfalseShows the score without allowing changes.

Filled stars use the ink action color, not a semantic hue, so the control stays inside the system. Each radio is labelled "1 star", "2 stars" and so on for screen readers.