Rating
Star rating built from radio buttons, so it submits with a form and needs no JavaScript.
Basic
<fieldset class="mn-rating" aria-label="Rating">
<input type="radio" id="r5" name="rating" value="5"><label for="r5" title="5 stars"><span class="mn-sr-only">5 stars</span></label>
<input type="radio" id="r4" name="rating" value="4" checked><label for="r4" title="4 stars"><span class="mn-sr-only">4 stars</span></label>
<input type="radio" id="r3" name="rating" value="3"><label for="r3" title="3 stars"><span class="mn-sr-only">3 stars</span></label>
<input type="radio" id="r2" name="rating" value="2"><label for="r2" title="2 stars"><span class="mn-sr-only">2 stars</span></label>
<input type="radio" id="r1" name="rating" value="1"><label for="r1" title="1 star"><span class="mn-sr-only">1 star</span></label>
</fieldset>Installation
Everything ships in one stylesheet. There is nothing to import per component.
<link rel="stylesheet" href="https://mian.ro/dist/mian.css">Prefer to own the files? /r/rating.json is a registry item with this component's CSS and example markup, ready to copy into your project with any tool that reads the open registry-item format.
Class reference
| Class / attribute | Description |
|---|---|
| mn-rating | A fieldset of radios in reverse order. |
| mn-rating-sm · mn-rating-lg | Sizes. |
Accessibility
- Each star is a radio with a text label ("3 stars"), so it is announced and arrow-keyable. Inputs are listed highest first for the CSS; the visual order is still left to right.