<baht-rating>
Star rating. Controlled; click the current value to clear.
Basic
Events (baht-change, baht-input, name)
<baht-rating value="3"></baht-rating>Read-only, custom max
Events (baht-change, baht-input, name)
<baht-rating value="7" max="10" readonly="true"></baht-rating>As a form field
Section titled “As a form field”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 }| Name | Type | Default | Description |
|---|---|---|---|
value | number | 0 | Current rating |
max | number | 5 | Star count |
label | string | 'Rating' | Standalone accessible name (a field uses its label) |
fieldJS | FieldDescriptor | — | Field descriptor (type: 'rating') — switches to field mode; set by <baht-form> |
disabled | boolean | false | |
readonly | boolean | false | Display only |
required | boolean | false | |
show-optional | boolean | false | Append the localized "(optional)" marker to the label when not required (set by <baht-form show-optional>). |
errorJS | string | null | null | |
debounce | number | undefined | — | Debounce for typed edits (ms); unset = BahtFieldBase.defaultDebounce. |
Events
Section titled “Events”| Event | detail | Description |
|---|---|---|
baht-change | { value } | Standalone: user picked a rating (0 = cleared) |
baht-input | { key, value } | Field mode: user picked a rating (null = cleared) |
name | CustomEvent |