Skip to content

Rating

Star-based rating control supporting read-only and interactive modes.

<Rating value={3} isReadOnly />
<Rating value={2} onChange={() => {}} />
<Rating value={4} isDisabled />
<div style={{display: 'flex', flexDirection: 'column', gap: '1rem'}}>
<Rating isReadOnly size="sm" value={3} />
<Rating isReadOnly size="md" value={3} />
<Rating isReadOnly size="lg" value={3} />
</div>
<Rating value={7} count={10} isReadOnly />
<Rating value={0} onChange={() => {}} />
<div style={{display: 'flex', flexDirection: 'column', gap: '1rem'}}>
<Rating emptyColor="gray" filledColor="red" isReadOnly value={3} />
<Rating emptyColor="gray" filledColor="green" isReadOnly value={4} />
<Rating emptyColor="gray" filledColor="blue" isReadOnly value={2} />
</div>

Star-based rating control supporting read-only and interactive modes.

PropTypeDefaultDescription
classNamestringAdditional CSS class names applied to the rating root.
countnumber5Number of stars to display.
data-testidstringTest ID applied to the rating root.
emptyColor"error" | "info" | "success" | "warning" | "primary" | "red" | "orange" | "yellow" | "green" | "teal" | "cyan" | "blue" | "purple" | "pink" | "gray" | "secondary" | "accent" | "disabled" | "inherit" | "tertiary"'disabled'Color of unfilled stars.
filledColor"error" | "info" | "success" | "warning" | "primary" | "red" | "orange" | "yellow" | "green" | "teal" | "cyan" | "blue" | "purple" | "pink" | "gray" | "secondary" | "accent" | "disabled" | "inherit" | "tertiary"'yellow'Color of filled stars.
isDisabledbooleanfalseWhether the rating is disabled.
isReadOnlybooleanfalseWhether the rating is read-only.
labelstring'Rating'Accessible label for the rating group.
onChange(value: number) => voidCalled when the selected rating changes.
refRef<HTMLDivElement>Ref forwarded to the rating root.
size"sm" | "md" | "lg"'md'Size of the star icons.
styleCSSPropertiesInline styles applied to the rating root.
value*numberCurrent rating value.