Rating

Data Display

Star rating component with half-star support, read-only mode, custom icons, and hover preview

Rating

Display star-style ratings with different icons, sizes, variants, half precision, counts, custom maximums, and interactive callbacks.

Basic ratings

Use the value prop to show a rating from 0 to max (default 5). Enable showValue to render the numeric value alongside.

Basic display

Default:
With value:
4.5
With count:
4.3(128 reviews)

Sizes

Control icon size with the size prop. Useful for compact table displays or prominent hero ratings.

Size options

Small:
Medium:
Large:
Extra large:

Variants

Align the rating with your design system using the variant prop, including glass and gradient effects.

Color & style variants

Default:
Primary:
Secondary:
Gradient:
Glass:
Outline:

Precision

Use precision="full" for whole icons, or "half" for half-step ratings like 4.5.

Half-star ratings

4.5 stars:
4.5
3.5 stars:
3.5
2.5 stars:
2.5

Icons

Change the visual appearance of the rating via the icon prop. Built-in options include star, heart, circle and diamond.

Different icons

Stars:
Hearts:
Circles:
Diamonds:

Interactive rating

Use onChange to capture user ratings. Use precision to control step size.

Click & hover to rate

Full stars:
Value: 0
Half stars:
0.0

Read-only & disabled

Show non-interactive ratings with readOnly, and completely disable the component using disabled.

Static ratings

Product:
4.7(2,541 reviews)
User review:
5(89 votes)
Disabled:

Custom max

Change the scale using max. You can still render the numeric value using showValue.

Out of 10, out of 3

Out of 10:
7/10
Out of 3:
2/3

Custom colors

Use color to override the icon color while still benefiting from the component’s hover and interaction behavior.

Brand & custom colors

Red hearts:
Green stars:
Purple stars:

Real-world usage

Combine ratings with rich UI for product cards and review forms.

Product & review flows

Wireless Headphones

Premium noise-canceling headphones

4.6(1,284 reviews)
$199
Write a Review
Overall Rating
Quality
Value for Money
Would Recommend

Usage Guidelines

When to Use

  • Product ratings
  • Feedback collection
  • Review displays

Accessibility

  • Current value announced
  • Read-only state indicated

Performance

  • CSS-based stars
  • Efficient hover preview

Common Mistakes

  • No feedback on selection
  • Too many stars (use 5)

Frequently Asked Questions

Yes, Rating supports half-star increments for precise ratings.
Yes, Rating can be read-only for display purposes.

View on GitHub

See the full source code on GitHub