OGE logoOGE

Rating

A star rating as a form editor — Kendo's Rating, PrimeNG's Rating: a value between 0 (not rated, committed as null) and max in steps of precision, so half stars and averages such as 4.3 render exactly. It is one APG role="slider" by default — arrows follow the reading direction, so RTL mirrors them — or a radio group of whole items with semantics="radiogroup".

Works standalone via [(value)], with Signal Forms via [formField], and with reactive/template forms via formControl/ngModel.

APG slider half values RTL forms

Getting started

Arrows step by one item (RTL-mirrored), PageUp/PageDown too, Home/End to the ends, the digit keys jump and Delete, Backspace or 0 clear. A press on the current value clears it while allowClear is on; the pointer previews the value it would pick.

value allowClear hover preview

Value: 3

Half and fractional values

precision sets the step: 0.5 for half stars — a press in an item's first half picks the half — or 0.1 to show an average exactly. readonly keeps the rating focusable and announced (aria-readonly) but unchangeable.

precision readonly max
2.5

Icons and templates

Pick a built-in glyph — 'star' | 'heart' | 'circle' — or render any markup with [ogeRatingItemTemplate]. The template runs once for the empty and once for the filled layer, so fractional fills still work. selection="single" paints only the item holding the value.

icon ogeRatingItemTemplate selection

Radio group semantics

semantics="radiogroup" renders one radio per item with a single roving tab stop: arrows move and select (wrapping at the ends), Space selects. It needs whole-item precision — fractional precisions fall back to the slider.

semantics APG radio group roving tabindex

Value: 4

Inside a form

A FormValueControl and a ControlValueAccessor: formControl, ngModel and [formField] all bind it. Not rated is null, so Validators.required means "rate it".

formControl Validators.required

Valid: false