Events in Rating Component

4 Nov 20251 minute to read

This section describes the rating events that will be triggered when appropriate actions are performed. The following events are available in the rating component.

Created

The rating component triggers the Created event after the component rendering is completed. Use this event for initialization logic that depends on the rendered UI.

@using Syncfusion.Blazor.Inputs

<SfRating Created="Created"></SfRating>

@code{
    public void Created()
    {
        // Here, you can customize your code.
    }
}

ValueChanged

The rating component triggers the ValueChanged event when the rating value changes. The new value is passed as the event argument.

@using Syncfusion.Blazor.Inputs

<SfRating ValueChanged="ValueChanged"></SfRating>

@code{
    public void ValueChanged(double args)
    {
        // Here, you can customize your code.
    }
}

OnItemHover

The rating component triggers the OnItemHover event when a rating item is hovered. The RatingHoverEventArgs in the event provides details such as the hovered item’s index and value.

@using Syncfusion.Blazor.Inputs

<SfRating OnItemHover="OnItemHovered"></SfRating>

@code{
    public void OnItemHovered(RatingHoverEventArgs args)
    {
        // Here, you can customize your code.
    }
}