Skip to content
bahtuiv0.18.8

<baht-rating>

Star rating. Controlled; click the current value to clear.

Basic

<baht-rating value="3"></baht-rating>

Read-only, custom max

<baht-rating value="7" max="10" readonly="true"></baht-rating>

In a form schema, type: 'rating' renders this element in field mode: the field’s label, help and error, field.max stars (whole number 1–10, default 5), and baht-input with a whole number of stars, or null when the current star is clicked again. The engine and bank20baht-validator reject anything outside 1…max; read-only display reads “4 of 5”.

{ "order": 3, "type": "rating", "key": "service", "label": "Service quality", "required": true, "max": 5 }
NameTypeDefaultDescription
valuenumber0Current rating
maxnumber5Star count
labelstring'Rating'Standalone accessible name (a field uses its label)
fieldJSFieldDescriptor—Field descriptor (type: 'rating') — switches to field mode; set by <baht-form>
disabledbooleanfalse
readonlybooleanfalseDisplay only
requiredbooleanfalse
show-optionalbooleanfalseAppend the localized "(optional)" marker to the label when not required (set by <baht-form show-optional>).
errorJSstring | nullnull
debouncenumber | undefined—Debounce for typed edits (ms); unset = BahtFieldBase.defaultDebounce.
EventdetailDescription
baht-change{ value }Standalone: user picked a rating (0 = cleared)
baht-input{ key, value }Field mode: user picked a rating (null = cleared)
nameCustomEvent