Duolith docs

Rating

A score out of a number of stars, chosen with a press or the arrow keys, or shown read-only.

Stability: experimental

Props

PropTypeDefaultMeans
labelstringWhat is rated; the group's accessible name.
valuenumberbindable(0)The score, from 1 to max; 0 for none yet. Bind it with bind:value={name}.
maxnumber5How many stars.
readonlybooleanfalseShows the score without letting it change.

States

StateLooks like
defaultStars up to the score are lit; the rest are the border colour.
read-onlyThe same stars, never focused.

Accessibility

roleradiogroup (img when read-only)
nameThe label prop; read-only, the label with the score.
focusOne Tab stop, on the chosen star (the first while there is none).
keyboardThe arrow keys move the score; Home and End go to the ends.

Theme tokens

color.border color.primary radius.md space.1

Example

<Rating label="Your rating" bind:value={stars} />