Rating
Star rating with fractional display, half-star input, hover preview, and keyboard support. Interactive mode is built on the reka-ui Rating primitives (a radiogroup with one radio per step); readonly mode renders a static star row so any decimal value stays exact.
Default
Interactive 5-star rating with v-model.
Fractional display
Any decimal value renders a partially filled star.
Half-star input
Maps to reka-ui step=0.5, so each star renders two radios: click or arrow onto the left half for a .5 value.
Show value
Display the numeric value beside the stars. It follows the hover preview while the pointer is over the stars.
Clearable
Click the current value again to reset the rating to 0.
Click star 3 again to clear
Custom length
Any number of stars via max, which maps to reka-ui length.
Sizes
sm, default, lg.
Colors
yellow (default), warning, primary, foreground.
Per-star classes
starClass reaches every star wrapper, for hover or transition effects.
Readonly
Display-only, no hover or keyboard.
Disabled
Dimmed and non-interactive for forms.
Composing the primitives
What Rating builds on. Use the reka-ui primitives directly when you need a shape this component does not cover — a different indicator, custom layout, or your own state handling.
Value: 2.5
API Reference
Rating
RatingRoot (reka-ui)
RatingItem (reka-ui)
RatingItemIndicator (reka-ui)
Accessibility
Keyboard shortcuts and ARIA behavior.
- Interactive ratings render a radiogroup with one radio per step; each radio is labelled "N of max" and exposes aria-checked.
- Readonly ratings render a static role="img" with an aria-label describing the value — no radios and no focus stops.
- Provide an aria-label (e.g. "Product rating") to name the group; it forwards to the root element.
- Arrows cannot reach 0 because there is no radio for it — use Home, or clearable to clear by clicking the current value.
- Star icons are aria-hidden; the value is conveyed by the radios (interactive) or the root aria-label (readonly).