Rating
Stars for a score — a read-only image that fills fractions, or a radio group to rate with the keyboard, as a form control.
Available in
Angular: available Vue: available React: available React Native: available
Usage
Your rating
Not rated yet · choose the same star again to clear.
<div class="demo-stack">
<div class="demo-row">
<sone-rating [value]="4.5" readonly size="sm" ariaLabel="Average rating" />
<span class="text-hint">4.5 · 128 reviews</span>
</div>
<div soneField>
<span soneFieldLabel id="demo-rating-label">Your rating</span>
<sone-rating [(value)]="score" clearable ariaLabel="Your rating" />
<p soneFieldDescription>{{ score() ? score() + ' of 5' : 'Not rated yet' }} · choose the same star again to clear.</p>
</div>
<div class="demo-row">
<sone-rating [value]="3" readonly size="sm" />
<sone-rating [value]="3" readonly />
<sone-rating [value]="3" readonly size="lg" />
</div>
</div>Import
import {
SoneRatingComponent,
} from "@surface-one/angular/rating";API reference
SoneRatingComponentComponent
Stars for a score. Read-only (`readonly`) it is one image named "4.5 out of 5" and fills fractions; interactive it is a native radio group — arrow keys move the score, every star is a labelled radio — and a ControlValueAccessor of `number` (0 = no rating).
| Name | Type | Default |
|---|---|---|
valuetwo-wayThe score, 0 to `max`. Fractions show only when read-only. | number | 0 |
max | number | 5 |
size | RatingSize | "default" |
readonlyShow the score without letting it change. | boolean | false |
disabled | boolean | false |
clearableChoosing the current score again clears it to 0. | boolean | false |
ariaLabelThe group's accessible name (interactive) or a prefix of the image's (read-only). | string | null | null |