Skip to content

Rating Group

A row of stars for choosing or showing a rating. The arrow keys move the rating one star at a time, and pointing at a star previews it. Name it with aria-label; readonly turns it into a display of a score. Built on the bits-ui RatingGroup.

Choosing a rating

Click a star, or focus the row and use the arrow keys. Pointing at a star previews it. Name the row with aria-label.

3 of 5

Showing a score

readonly turns it into a display, such as a product's rounded average.

4.4 · 128 reviews

API

Prop Type Default Description
value bindable number 0

The rating. Two-way bindable via bind:value.

max number

Number of stars (forwarded via ...rest).

readonly boolean

Shows the rating without letting it change (forwarded via ...rest).

onValueChange (value: number) => void

Called when the rating changes (forwarded via ...rest).

aria-valuetext string | ((value: number, max: number) => string)

How the rating is read out (forwarded via ...rest).

class string

Additional Tailwind classes merged onto the row.