UIComponentsReact
Stars that show a score that cannot be changed, such as an average of reviews.
Built on the headless Rating Display.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/rating-display.jsonIt also adds utils. The app needs its setup first: Installation.
Usage
Pass value (any number, clamped to 0 to max) and write one RatingDisplayItem per star, with index from 1 to max. Each star fills as far as the value reaches through --rating-item-fill, so 4.3 fills a third of the fifth star. The stars are one image, named "Rated 4.3 out of 5", from the headless Rating Display.
import { RatingDisplay, RatingDisplayItem } from '@/components/ui/rating-display'Examples
shadcn/ui has no Rating Display, so this item takes Base UI's component ID as its slug and one name per Base UI part. It is Rating's star at icon size; use Rating where the reader picks a score.
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Rating Display's API reference.