Rating

Collect product scores, satisfaction signals, and read-only rating summaries with accessible radio semantics.

Product rating
Usage Example
@rating.Rating(rating.Config{
    ID: "rating-default",
    Name: "rating",
    Value: 3,
    Label: "Product rating",
})

Emoji Rating

Switch to sentiment icons for feedback flows that should feel more conversational.

Satisfaction
Emoji Rating
@rating.Rating(rating.Config{
    ID: "rating-emoji",
    Name: "sentiment",
    Value: 4,
    Style: rating.StyleEmoji,
    Label: "Satisfaction",
})

Sizes

Use SizeSM, SizeMD, SizeLG, or SizeXL to fit dense forms or larger feedback moments.

Small
Medium
Large
XL
Sizes
@rating.Rating(rating.Config{
    ID: "rating-size-md",
    Name: "rating-size-md",
    Value: 3,
    Size: rating.SizeMD,
    Label: "Medium",
    ShowLabel: true,
})

Disabled

Disabled ratings keep their selected value visible while blocking interaction.

Locked rating
Disabled
@rating.Rating(rating.Config{
    ID: "rating-disabled",
    Name: "disabled-rating",
    Value: 2,
    Disabled: true,
})

Read Only

ReadOnly renders the same visual language as a non-interactive summary.

Read Only
@rating.Rating(rating.Config{
    ID: "rating-readonly",
    Value: 4,
    ReadOnly: true,
    Label: "Average rating",
    ShowLabel: true,
})

API Reference

PropTypeDefaultDescription
IDstring""Prefix for generated input IDs. Falls back to Name, then "rating".
Namestring""Radio group field name. Falls back to ID.
Valueint0Initially selected rating, clamped to 0..Max.
Maxint5Number of rating options.
Labelstring"Rating"Accessible radiogroup label; visible when ShowLabel is true.
ShowLabelboolfalseRenders the label above the control.
StyleStyleStyleStarsVisual style: "stars" or "emoji".
SizeSizeSizeMDIcon size: "sm", "md", "lg", "xl".
DisabledboolfalseDisables all radio inputs.
ReadOnlyboolfalseRenders a non-interactive rating summary.
Attrstempl.AttributesnilEscape hatch applied last to the root element.
Classstring""Extra classes appended to the root element.