Completed
Last Updated: 25 Aug 2022 12:24 by Jassen
Release 2.13.0
Josep Ramon
Created on: 21 Apr 2020 13:48
Category: TextBox
Type: Bug Report
2
Width is not applied when Label is used for the TextBox
The floating label element has a default width in the CSS, and the custom Width value from the TelerikTextBox Width parameter is not applied to it - it is only set to the input.
4 comments
Jassen
Posted on: 25 Aug 2022 12:24
Thank you for checking and the link to the demo. I concur. I must be having some other CSS problem...
ADMIN
Dimo
Posted on: 24 Aug 2022 07:55

Hi Jassen,

This thread is related to an older Telerik UI for Blazor version that had different label configuration and rendering.

Currently (3.5.0), there are two possible scenarios and both work as intended:

  • The label may be shorter than the textbox width, so it is completely visible.
  • If the label is longer than the textbox, it will be clipped. A too long label raises the question how to handle it seamlessly out-of-the-box. In other words, how do we allocate space for a longer label, given that such space may not exist in the page layout?

Here is how to workaround the built-in behavior and make the label expand outside the textbox, if you wish:

<TelerikFloatingLabel Class="long-label" Text="The label is longer than the textbox width (workaround)">
    <TelerikTextBox @bind-Value="@TextBoxValue" Width="200px" />
</TelerikFloatingLabel>

<style>
    .long-label.k-floating-label-container.k-focus .k-label {
        overflow: visible;
    }
</style>

@code {
    string TextBoxValue { get; set; }
}

Regards,
Dimo
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Jassen
Posted on: 17 Aug 2022 22:16
This bug is still present in the Telerik.UI.for.Blazor 3.5.0 component...
ADMIN
Marin Bratanov
Posted on: 21 Apr 2020 13:51

For Width="100%" for the textbox, the following can be a workaround:

<style>
    .k-floating-label-container {
        width: 100%;
    }
</style>

<div style="width: 400px; border: 1px solid red;">
    <TelerikTextBox Label="the label" Width="100%" @bind-Value="@theValue"></TelerikTextBox>
</div>
@code{
    string theValue { get; set; } = "lorem ipsum dolor sit amet";
}

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.