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
Show code
<Rating label="Quality" bind:value={score} />Read only
Show code
<Rating label="Average score" value={4} readonly />Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | 0 | Selected score. Bind it with bind:value. |
max | number | 5 | Number of stars. |
label | string | "Rating" | Accessible name for the radiogroup. |
readonly | boolean | false | Shows 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.