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

Where in the docs are @attributes referenced?

2 Answers 392 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
BitShift
Top achievements
Rank 1
Veteran
BitShift asked on 18 Jun 2020, 10:03 PM
When Im using a component such as a TelerikButton, there is a property @attributes.  Where can I see an example of how / what its used for?  Can I place a style string in it ?

2 Answers, 1 is accepted

Sort by
0
BitShift
Top achievements
Rank 1
Veteran
answered on 18 Jun 2020, 10:08 PM

Nevermind, thats an example of "attribute splatting".  However, the question still stands, is there a way to specify some style value, such as padding on a button within the component markup itself?
<TelerikButton OnClick="@OnSaveHandler">Save</TelerikButton><br/>

or one way I guess would be to wrap the button in a span and put the style there...

0
Accepted
Svetoslav Dimitrov
Telerik team
answered on 19 Jun 2020, 02:35 PM

Hello Randal,

The @attributes directive comes from the framework as you have mentioned in your second post. You can read more on why this directive will not be implemented in Telerik UI for Blazor in this page: https://feedback.telerik.com/blazor/1416978-support-arbitrary-attributes

Regarding the styling of the Button. You could use the Class parameter of the component to add a CSS class and cascade some styles through it. Below, you can see a quick code snippet to illustrate that:

 

<style>
    .mySaveButton.k-button {
        padding-left: 50px;
    }
</style>

<TelerikButton OnClick="@OnSaveHandler" Icon="@IconName.Save" Class="mySaveButton">Save</TelerikButton>

@code {
    void OnSaveHandler()
    {
        //your custom code here
    }
}

 

Regards,
Svetoslav Dimitrov
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.
Tags
General Discussions
Asked by
BitShift
Top achievements
Rank 1
Veteran
Answers by
BitShift
Top achievements
Rank 1
Veteran
Svetoslav Dimitrov
Telerik team
Share this question
or