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

Adding an icon within Input component

3 Answers 1867 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Thaban
Top achievements
Rank 1
Thaban asked on 16 Nov 2019, 12:53 AM

Hi,

I don't see any examples of adding an icon within a input component. I need to be able to put it on the right of left side of icon within the input box. Can someone explain how to do this?

Thaban

3 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 18 Nov 2019, 09:15 AM

Hello, Thaban,

This can be achieved using some of the KendoReact classes and a span element to wrap the input and the icon.

This is an example of inputs with icon and the left and input with icon on the right:

https://stackblitz.com/edit/react-w8gjvn?file=app/main.jsx

I hope this is helpful.

Regards,
Stefan
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Thaban
Top achievements
Rank 1
answered on 18 Nov 2019, 06:53 PM

Hi Stefan,

How can i use this with Input React Component. I need to also use this with Masked Input and Numeric Input. This method is seems to create input using html tag <input> not the react input <Input>.

Thanks,

 

Thaban

0
Stefan
Telerik team
answered on 19 Nov 2019, 09:37 AM

Hello, Thaban,

Currently, this is the supported way, as the input elements do not allow rendering other elements inside of them. This is how the DOM input element works, and we have no control over it.

The only possibility is to use a wrapper element and place the icon inside it, then set a border to that element, and remove the border of the input type element.

As for the Numeric and the MaskedTextBox, this will require custom DOM manipulations to add the icon element inside of it:

https://stackblitz.com/edit/react-w8gjvn-o9avwm?file=app/main.jsx

Please have in mind that this is not supported out of the box, so it will require custom code and styles.

Regards,
Stefan
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Thaban
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Thaban
Top achievements
Rank 1
Share this question
or