COMPONENTS
Star ratings
One rating class supports an accessible read-only display or native radio choices that submit ordinary form values.
Usage
Markup: fieldset.rating > legend, label > input[type=radio], span; labelled .rating display
Behaviour: Integer star selection without JavaScript; backend supplies averages and submissions.
- Read-only ratings need an explicit accessible label and visible numeric value. The application supplies both the stars and their matching value; CSS calculates no average.
- For selection, put class="rating" on a fieldset with a legend. Each label contains a named native radio, a decorative SVG star with aria-hidden=true, and text such as "3 stars". Arrow keys, disabled and required states, form submission and reset remain native.
- This pattern uses integer ratings from one to five. Choices begin unset unless the server marks one checked. Use a normal reset button to clear an initially unset group.
- Filled stars identify every value up to the checked choice. Focus is visible on the corresponding star. No new data attributes or JavaScript.
Component API and styling module · Inherited appearance settings
A published rating
Text communicates the value without relying on colour or star glyphs.
4 out of 5 · 12 reviews
Choose a rating
Native radio values remain available to a normal form action. No review is submitted by this example.
Unavailable selection
Disabled native choices preserve their state and cannot be changed.