GitHub

Rating

Star rating control with half-star precision, custom max, and model binding.

<rhx-rating>

Examples

Basic

Pre-set Value

Half-star Precision

Custom Max

Readonly

Sizes

States

Model Binding

htmx Integration

Click a star to submit your rating...

Properties

Property Type Default Description
rhx-for ModelExpression - ASP.NET Core model expression for two-way binding
name string - The form field name
value string - The current rating value
rhx-label string - Accessible label for the rating group
rhx-max int 5 Maximum number of stars
rhx-precision double 1 Rating precision: 1 or 0.5
rhx-readonly bool false Display-only mode
rhx-size string medium Rating size: small, medium, large
rhx-disabled bool false Whether the rating is disabled

Accessibility

  • Uses role="radiogroup" with individual star buttons acting as radio inputs.
  • Each star has an aria-label describing its value (e.g., "3 out of 5 stars").
  • Keyboard arrow keys navigate between star values.
  • Readonly mode uses aria-readonly="true" and removes interactive elements.