RatingGroup

Data input

A rating out of max stars (5 by default), announced as a slider: <RatingGroup.Root> (bind:value, allowHalf, readonly, name) draws its stars when it has no children; for custom ones, render RatingGroup.Items (index) from the children snippet's items; each item's own children snippet gets its state. Arrow keys change the rating, Home and End go to the ends. Inside a Field it is named by Field.Label; outside one, give it aria-label.

import { RatingGroup } from '@limerdev/zest';
RatingGroup for AI tools (llms.txt)
Use for
Rating something: feedback on a delivery, how a sprint went.
Don't
A choice between named options: use RadioGroup. Showing an average read-only without the number: show the number too.

Examples

Basic

In a Field the label names the rating. allowHalf allows half stars; readonly shows a rating that can't change.

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

RatingGroup.Root

Prop Type Default Description
allowHalf boolean false Whether to allow half-star ratings.
aria-valuetext RatingGroupAriaValuetext ((value: number, max: number) => `${value} out of ${max}`) An extended aria-valuetext property to use for the rating group. Can either be a string, or a function that receives the current value and max value and returns a string.
disabled boolean false Whether the rating group is disabled.
hoverPreview boolean true Whether to show a preview when hovering over rating items. Touch events are ignored to prevent accidental previews.
max number 5 The maximum rating value (number of items).
min number 0 The minimum rating value.
name string undefined The name to apply to the rating group's input element for form submission. If not provided, a hidden input will not be rendered and the rating group will not be part of a form.
onValueChange OnChangeFn<number> – The callback to call when the rating value changes.
orientation "horizontal" | "vertical" "horizontal" The orientation of the rating group. Used to determine how keyboard interactions work.
readonly boolean false Whether the rating group is readonly.
required boolean false Whether the rating group is required for form submission. If true, ensure you provide a name prop so the hidden input is rendered.
value bindable number 0 The current rating value.

RatingGroup.Item

Prop Type Default Description
disabled null | false | true false Whether the rating item is disabled.
index required number – The index of the rating item (0-based index).