This library provides additional TagHelpers for ASP.NET Core that can be used to write cleaner code in Razor.
You can install the TagHelpers using the following command.
dotnet add package Zenima.TagHelpers
To be able to use it in your Razor views, you have to reference it in the _ViewImports.cshtml
file by adding the following line:
@addTagHelper *, Zenima.TagHelpers
Can be used on any existing tag.
Attribute | Functionality |
---|---|
display |
Enable/disable tag visibility |
display-wrapper |
Enable/disable wrapper tag visibility |
Example:
<div display="@User.LoggedIn()">
<span>Welcome @User.Name</span>
</div>
Example:
<a href="@item.Url" display-wrapper="@item.ShowLink">
<span>@item.Name</span>
</a>