Class RadzenRating
A star rating input component that allows users to provide ratings by selecting a number of stars. RadzenRating displays an interactive or read-only star rating with configurable number of stars and keyboard accessibility. Displays a row of stars (or other symbols) that users can click to select a rating value. The value is an integer from 0 to the number of stars configured. Common uses include product reviews and ratings, user feedback and satisfaction surveys, content quality indicators, and service ratings. Supports keyboard navigation (arrow keys, Space/Enter) for accessibility. Use ReadOnly mode to display ratings without allowing user input.
Inherited Members
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
Syntax
public class RadzenRating : FormComponent<int>, IComponent, IHandleEvent, IHandleAfterRender, IDisposable, IRadzenFormComponent
Examples
Basic 5-star rating:
<RadzenRating @bind-Value=@rating />
Custom number of stars with change event:
<RadzenRating @bind-Value=@userRating Stars="10" Change=@(args => Console.WriteLine($"Rated: {args} out of 10")) />
Read-only rating display:
<RadzenRating Value=@product.AverageRating Stars="5" ReadOnly="true" />
<RadzenText>@product.AverageRating out of 5 stars</RadzenText>
Constructors
RadzenRating()
A star rating input component that allows users to provide ratings by selecting a number of stars. RadzenRating displays an interactive or read-only star rating with configurable number of stars and keyboard accessibility. Displays a row of stars (or other symbols) that users can click to select a rating value. The value is an integer from 0 to the number of stars configured. Common uses include product reviews and ratings, user feedback and satisfaction surveys, content quality indicators, and service ratings. Supports keyboard navigation (arrow keys, Space/Enter) for accessibility. Use ReadOnly mode to display ratings without allowing user input.
Declaration
public RadzenRating()
Examples
Basic 5-star rating:
<RadzenRating @bind-Value=@rating />
Custom number of stars with change event:
<RadzenRating @bind-Value=@userRating Stars="10" Change=@(args => Console.WriteLine($"Rated: {args} out of 10")) />
Read-only rating display:
<RadzenRating Value=@product.AverageRating Stars="5" ReadOnly="true" />
<RadzenText>@product.AverageRating out of 5 stars</RadzenText>
Properties
ClearAriaLabel
Gets or sets the accessible label text for the clear rating action. Used by screen readers to announce the clear/reset rating button functionality.
Declaration
[Parameter]
public string ClearAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The ARIA label for clearing the rating. Default is "Clear". |
RateAriaLabel
Gets or sets the accessible label text template for rating actions. Used by screen readers to announce each star's rating value (e.g., "Rate 3 stars").
Declaration
[Parameter]
public string RateAriaLabel { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The ARIA label for rating actions. Default is "Rate". |
ReadOnly
Gets or sets whether the rating is read-only and cannot be changed by user interaction. When true, the stars display the current rating but cannot be clicked or modified. Useful for displaying ratings without allowing users to change them (e.g., showing product ratings).
Declaration
[Parameter]
public bool ReadOnly { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Stars
Gets or sets the total number of stars to display in the rating component. The value can range from 0 to this number. Common values are 5 or 10.
Declaration
[Parameter]
public int Stars { get; set; }
Property Value
| Type | Description |
|---|---|
| int | The total number of stars. Default is 5. |
Methods
BuildRenderTree(RenderTreeBuilder)
A star rating input component that allows users to provide ratings by selecting a number of stars. RadzenRating displays an interactive or read-only star rating with configurable number of stars and keyboard accessibility. Displays a row of stars (or other symbols) that users can click to select a rating value. The value is an integer from 0 to the number of stars configured. Common uses include product reviews and ratings, user feedback and satisfaction surveys, content quality indicators, and service ratings. Supports keyboard navigation (arrow keys, Space/Enter) for accessibility. Use ReadOnly mode to display ratings without allowing user input.
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
GetComponentCssClass()
Gets the component CSS class.
Declaration
protected override string GetComponentCssClass()
Returns
| Type | Description |
|---|---|
| string |