This is a migrated thread and some comments may be shown as answers.

Adding icons to Kendo textbox

5 Answers 2982 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Responsive
Top achievements
Rank 1
Veteran
Responsive asked on 14 Aug 2020, 07:00 PM
Is there a way to display a k-icon inside a Kendo textbox? For example, displaying the k-i-email in a Kendo textbox for an email address.

5 Answers, 1 is accepted

Sort by
0
Silviya Stoyanova
Telerik team
answered on 17 Aug 2020, 07:49 AM

Hello,

I would suggest following the approach demonstrated in this forum thread:

I hope that helps.

Kind Regards,
Silviya Stoyanova
Progress Telerik

0
Responsive
Top achievements
Rank 1
Veteran
answered on 17 Aug 2020, 03:48 PM

Thanks, but I already tried applying this to my situation with no luck.

I would like to use Kendo icons and Kendo text box controls. The best I can get it to do with a standard Razor textbox is a tiny icon crammed into a corner. With a Kendo control, the same tiny icon remains outside the textbox.

0
Tsvetomir
Telerik team
answered on 19 Aug 2020, 12:24 PM

Hi,

My name is Tsvetomir and I will continue the communication over this thread. 

Indeed, the conventional TextBox HtmlHelper differs from the Kendo UI TextBox widget. I have tweaked the example from the referenced forum thread and it appears that the icon is positioned within the scope of the TextBox. Here is the updated markup:

<form style="width: 500px;">
    <div class="form-group has-success has-feedback">
        @(Html.Kendo().TextBox().Name("name").HtmlAttributes(new { @class = "form-control", style="width:100%", @placeholder = "Email Address" }))
        <span id="casd" class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>
    </div>
</form>

 

Regards,
Tsvetomir
Progress Telerik

0
Responsive
Top achievements
Rank 1
Veteran
answered on 19 Aug 2020, 10:32 PM

The code below, renders a text box as per the attached image.

I should also point out that the default bootstrap-v4 Kendo theme is applied and Bootstrap 4.5.2 and Font Awesome 5.7.0 are referenced.

What am I missing?

<form style="width: 500px;">
    <div class="form-group">
        <div class="input-group">
            @(Html.Kendo().TextBox().Name("name").HtmlAttributes(new { @class = "form-control", style="width:100%", @placeholder = "Email Address" }))
            <span aria-hidden="true"><i class="fas fa-lock"></i></span>
        </div>
    </div>
</form>

0
Tsvetomir
Telerik team
answered on 21 Aug 2020, 12:48 PM

Hi,

Adding the form-control-feedback class to the span containing the icon should resolve the positioning issue:

<form style="width: 500px;">
    <div class="form-group">
        <div class="input-group">
            @(Html.Kendo().TextBox().Name("name").HtmlAttributes(new { @class = "form-control", style="width:100%", @placeholder = "Email Address" }))
            <span aria-hidden="true"  class="form-control-feedback"><i class="fas fa-lock"></i></span>
        </div>
    </div>
</form>

 

Regards,
Tsvetomir
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TextBox
Asked by
Responsive
Top achievements
Rank 1
Veteran
Answers by
Silviya Stoyanova
Telerik team
Responsive
Top achievements
Rank 1
Veteran
Tsvetomir
Telerik team
Share this question
or