How do you conditionally hide the DOM elements?

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

DOM elements are hidden using the hidden attribute. You can conditionally use any .NET parameter to set this attribute to hide the DOM elements.

@page "/"
    
   <p hidden="@IsShow">I am Blazor</p>
    
   <button @onclick="@Show">Show/Hide</button>
 @code {
       private bool IsShow   {get;set;} = false;
       private void Show()
       {
           IsShow =   !IsShow;
       }      
 }