Star rating, for display (true decimal precision: 4.3 fills 30% of the 5th star, review count as a link) or as form-associated input: half stars, hover preview, captions like “Very good”, full keyboard support, clearing, required; compact variant ★ 4.8 (2,413).
Rating (0 = none). Observed: a framework can drive it via the attribute.
max
number
5
Number of stars.
precision
1 | 0.5
1
Input step (0.5 = half stars).
readonly
boolean
Display mode: role=img, unrounded value.
clearable
boolean
Clicking the current rating again clears it.
name / required / disabled
string / boolean
Form: submitted value “4.5”, valueMissing when required and empty.
count
number
Review count shown (“128 reviews”).
href
string
Turns the review count into a link (anchor to the reviews section).
show-value
boolean
Shows the numeric rating (“4.6”).
label
string
Rating
Accessible name (otherwise <label for>).
captions
string
Poor,Fair,Good,Very good,Excellent
Per-star captions, shown during input and read in aria-valuetext.
locale
string
en-US
Number formatting.
data-size
sm | lg | xl
Star size.
data-variant
compact
One star + rating + (count).
invalid
boolean
Error style.
Properties
Name
Type
Description
value
number
Current rating.
form / validity / labels
Via ElementInternals.
Methods
Name
Description
focus()
Focuses the star slider.
checkValidity() / reportValidity()
Native validation.
Events
Name
Description
mv-change
User change. detail: { value, label }.
CSS classes
Name
Description
mv-rating-stars / -star / -value / -text / -count
Generated parts; --_fill (0…1) on each star.
CSS variables
Name
Default
Description
--mv-rating-size
1.125rem
Size of one star.
--mv-rating-color
var(--mv-warning)
Filled stars.
--mv-rating-empty-color
gray
Empty stars.
Accessibility
Display: role=img with aria-label “Rating: 4.6 out of 5 (128 reviews)”. Input: APG “Rating slider” pattern, a single focusable role=slider element, aria-valuenow / aria-valuetext (“4 stars out of 5, Very good” or “No rating”). Arrow keys ±precision (reversed in RTL), Page Up/Down ±1, Home/End, digits 0–9 directly, Backspace/Delete clears. Hover is only a preview; focus stays visible. Name via <label for>, label or aria-label.