Rating

A star rating, read-only or as an input.

<Rating.Root value={4.2} count={128} />
 
<Rating.Input value={value} onChange={setValue} />

Rating displays and accepts fractions; Rating.Input collects a whole number from the user. Rating.ReviewItem lays out a rating with its author and comment.

API

Rating.Root

PropTypeDefault
valuenumberrequired
countnumber—
maxnumberMAX_STARS
sizeRatingSize"default"
exitExit—Inside a <Presence>: plays this child's way out before it unmounts.

Plus every <div> prop. Source: rating/components/rating-root.tsx.

Rating.Input

PropTypeDefault
onChange(value: number) => voidrequired
valuenumberrequired
disabledbooleanfalse
maxnumberMAX_STARS
namestring—
sizeRatingSize"default"
exitExit—Inside a <Presence>: plays this child's way out before it unmounts.

Plus every <div> prop. Source: rating/components/rating-input.tsx.

Rating.ReviewItem

PropTypeDefault
authorNamestringrequired
ratingnumberrequired
authorAvatarSrcstring—
dateReactNode—Pre-formatted date string (the kit stays locale-agnostic).
exitExit—Inside a <Presence>: plays this child's way out before it unmounts.

Plus every <div> prop. Source: rating/components/review-item.tsx.