setting component attributes - eg color, size, etc

Posted 3 years ago by Rexadecimal
0

hi,

can anyone point me to a simple example of how to set say background color of a <InputSelect> or <InputText> type component? Do I set some values in the Attribute property of the component? If so - is there a list of settable attributes somewhere? I can't find any good books on Blazor. Can anyone recommend one?

Many thanks.

 

  • 0

    Try something like this:

    MyComponent.razor

    <div class="container-div">
    	<InputText @bind-Value="AddYourPropertyHere" class="myclass" />
    </div>

    MyComponent.razor.css (add this stylesheet using CSS Isolation)

    .container-div ::deep input.myclass {
    	background-color: #f00;
    }

    InputText is basically a component that uses the input tag in it, so using ::deep allows you to reach into the component from the parent component (MyComponent.razor).

    Posted 3 years ago by selliott Edited 3 years ago
Someone is typing...

Post a Reply

You must be logged in to add a new post.
Number of online users: 3
An error has occurred. This application may no longer respond until reloaded. Reload 🗙