Live Chat Icon For mobile
Live Chat Icon

How do you render elements with conditional attributes?

Platform: Blazor| Category : Data binding, Tips and Tricks

DOM attributes are rendered based on .NET parameters. If the parameter value is true, the attribute is rendered minimized, otherwise it’s not. Refer to the code example to render the checked attribute conditionally.

 <input type="checkbox" checked="@IsChecked">
 @code {
     public bool IsChecked { get; set; }

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.