Feature or Bug!

2 Answers 92 Views
TextArea
Martin Herløv
Top achievements
Rank 2
Bronze
Iron
Iron
Martin Herløv asked on 09 Nov 2021, 02:28 PM

I am trying to style the TexArea component.

Unfortunately the class attribute only affects the span wrapper element, Why?

I found that this is expected after reading the manual, so it's not a bug or is it (-.

I ended up using the standard textarea

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 09 Nov 2021, 08:12 PM

Hi Martin,

The Class of the component should render on its main wrapping element in general. This lets you cascade through it to provide styling to all elements inside. Otherwise, there will be elements you can't target, and you won't be able to target the topmost element of the component.

Here's an example of such cascades I made for you:

<style>
    .my-class textarea{
        color: red; 
    }
    .my-class .k-label {
        color: cyan;
    }
</style>

<TelerikTextArea Class="my-class" Label="see the html with the label"></TelerikTextArea>

Regards,
Marin Bratanov
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/.

0
Martin Herløv
Top achievements
Rank 2
Bronze
Iron
Iron
answered on 10 Nov 2021, 11:48 AM

Of course this is possible but still a surprise that you wrap the textarea in a span.

Sometimes the component abstraction layer confuses me (: This old dog need to learn some new tricks.

Marin Bratanov
Telerik team
commented on 11 Nov 2021, 08:23 PM

That's a rather common trend in the component suite - we often have a wrapping element even over things that seem simple, because we add functionality that often does not exist in the plain html counterpart, and that usually requires some cascades, and extra elements, so we need to keep everything contained.
Tags
TextArea
Asked by
Martin Herløv
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Marin Bratanov
Telerik team
Martin Herløv
Top achievements
Rank 2
Bronze
Iron
Iron
Share this question
or