Templates
By default, each Rating item is rendered with a star icon from the Kendo Web SVG Icons.
To modify the default icon, use the ItemTemplate
, SelectedTemplate
, and HoveredTemplate
properties.
Item Template
The item template specifies the template which is used for rendering the items of the Rating. If the SelectedTemplate
is not specified, the helper will use the default start icon for selected items. Therefore, it is recommended that you specify the SelectedTemplate
when the ItemTemplate
option is used.
@(Html.Kendo().Rating()
.Name("rating")
.Min(1)
.Max(6)
.Value(3)
.ItemTemplate("<i class='k-icon k-i-heart-outline'></i>")
.SelectedTemplate("<i class='k-icon k-i-heart'></i>")
)
Selected Template
The selected template specifies the template for rendering the selected state of the items. If the ItemTemplate
is not specified, the helper will use the default start icon for displaying the normal state of the items. Therefore, it is recommended that you specify the ItemTemplate
when the SelectedTemplate
option is used.
When the Rating is in half precision mode, use the same template for both the
SelectedTemplate
andHoveredTemplate
options.
@(Html.Kendo().Rating()
.Name("rating")
.Min(1)
.Max(6)
.Value(3)
.ItemTemplate("<i class='k-icon k-i-heart-outline'></i>")
.SelectedTemplate("<i class='k-icon k-i-heart'></i>")
)
Hovered Template
The hovered template specifies the template which is used for rendering the hovered state of the items. If the ItemTemplate
is not specified, the helper will use the default start icon for displaying the normal and selected state of the items.
When the Rating is in half precision mode, use the same template for both the
SelectedTemplate
andHoveredTemplate
options.
@(Html.Kendo().Rating()
.Name("rating")
.Min(1)
.Max(6)
.Value(3)
.HoveredTemplate("<i class='k-icon k-i-heart'></i>")
)