build69
build69  /  Components  /  Selection & Choice  /  Rating

Rating

v1.0.6Updated 4 Oct 2026

Five-star rating with half-star precision, hover preview, hover labels, custom icon support, read-only / disabled states, and three sizes.

Preview

Live · 11 stories
DefaultOpen ↗
▸Why this is recommendedformratingstarsreview+2

The default, out-of-the-box Rating.

Recommended for+14
  • ✓Review / feedback forms
  • ✓Product ratings
  • ✓Like / favourite controls
Tags+6
formratingstarsreviewhalf-stardefault
Features+4
  • 1-5 stars (configurable max)
  • Precision: 0.5 (half-star) or 1
  • Hover preview
  • Hover label slot
  • Custom icon (heart, thumbs-up, …)
  • Read-only + disabled states
  • Sizes sm / md / lg
  • Labelled by FormField: the div role=slider takes the id and is named by the field label through aria-labelledby; the built-in "Rating" name steps aside
Not recommended for−2
  • ✕Numeric input with > 10 values (use Slider)
  • ✕Yes / no (use Switch)

Install

Ask your agent, or call the MCP tool directly. The resolved bundle is written into your project.

get_registry_item({ name: "Rating" })

Usage

import { Rating } from '@/components/inputs/rating';

<Rating value={rating} onValueChange={setRating} precision={0.5} hoverLabels={["Hated it", "Disliked", "OK", "Liked", "Loved it"]} />

Tick variants in the left menu — each adds a tab with that variant’s real story source, the same code the preview above renders.

Props

PropTypeRequired
value

Current rating

number—
onValueChange

Value change callback

function—
max

Maximum stars

number—
precision

Step precision

0.5 | 1—
icon

Custom icon

ReactNode—
readOnly

Read-only display

boolean—
hoverLabels

Per-step hover labels

string[]—
aria-label

Accessible name; defaults to labels.ariaLabel ("Rating") except inside a labelled FormField

string—
aria-labelledby

Id(s) of the element(s) that label the slider; wins over a FormField label

string—
id

DOM id set on the focusable slider; FormField clones its field id in, and its label then names the control

string—
aria-describedby

Id(s) of hint or error text describing the slider (FormField clones this in)

string—
aria-invalid

Mark the slider invalid; FormField clones this in from its error prop

boolean—
aria-required

Mark the slider required; FormField clones this in from its required prop

boolean—

Related