Floating Label
A floating label is a placeholder text for form or input fields, which floats above that field and remains visible once the user starts interacting with that field.
To implement a floating label in the Telerik UI DateInput for ASP.NET Core, define it either as a string or from a function handler.
The following example demonstrates how to set the floating label as a string:
@(Html.Kendo().DateInput()
.Name("datepicker")
.Label(label =>
{
label.Content("Enter a date...");
label.Floating(true);
})
.HtmlAttributes(new { style = "width: 100%", title = "dateinput" })
)
<kendo-dateinput name="datepicker" title="dateinput" style="width:100%">
<label content="Enter a date..." floating="true" />
</kendo-dateinput>
The following example demonstrates how to set the floating label from a function handler:
@(Html.Kendo().DateInput()
.Name("datepicker")
.Label(label =>
{
label.ContentHandler("contentHandler");
label.Floating(true);
})
.HtmlAttributes(new { style = "width: 100%", title = "dateinput" })
)
<script>
function contentHandler(){
return "Enter a date...";
}
</script>
<kendo-dateinput name="datepicker" title="dateinput" style="width:100%">
<label content-handler="contentHandler" floating="true" />
</kendo-dateinput>
<script>
function contentHandler(){
return "Enter a date...";
}
</script>