- Tooltip template
- Tooltip customization
Contact Support
Tooltip in ASP.NET Core Rating Control
23 Jan 20232 minutes to read
The ASP.NET Core rating control supports tooltip to show additional information in rating items by setting the showTooltip property. If enabled, the tooltip appears when the user hovers over a rating item.
@using Syncfusion.EJ2.Inputs
<ejs-rating id="rating" value=3 showTooltip=true></ejs-rating>
Tooltip template
You can use the tooltipTemplate tag directive to specify a custom template for the Tooltip
of the rating. The current value of the rating will be passed as the value
property in the template context when building the content of the tooltip. This allows you to include dynamic information about the rating in the template.
@using Syncfusion.EJ2.Inputs
<ejs-rating id="rating" value=4 tooltipTemplate="#template"></ejs-rating>
<script id="template" type="text/x-jsrender">
${if(value==1)}
<b>Angry</b>${else if(value==2)}
<b>Sad</b>${else if(value==3)}
<b>Neutral</b>${else if(value==4)}
<b>Good</b>${else}
<b>Happy</b>
${/if}
</script>
Tooltip customization
You can customize the appearance of the tooltips using the cssClass
property of the ASP.NET Core Rating control and by defining the custom styles for tooltip elements like the below example.
NOTE
You can find more information about customizing the appearance of the tooltip in the Tooltip Customization documentation.
@using Syncfusion.EJ2.Inputs
<ejs-rating id="rating" value=3 cssClass="customtooltip"></ejs-rating>
<style>
/* To change the radius of the tooltip corners. */
.customtooltip.e-tooltip-wrap {
border-radius: 3px;
}
/* To change the size of the tooltip content. */
.customtooltip.e-tooltip-wrap .e-tip-content {
font-size:14px;
}
/* To change the border color and width for tooltip. */
.customtooltip.e-tooltip-wrap.e-popup {
border: 2px solid #969393;
}
/* To change the color for arrow of the tooltip. */
.customtooltip.e-tooltip-wrap .e-arrow-tip-inner.e-tip-bottom {
border: 12px solid #9693
}
/* To change the top border color for arrow of the tooltip. */
.customtooltip.e-tooltip-wrap .e-arrow-tip-outer.e-tip-bottom {
border-top: 12.5px solid #969393;
}
</style>