Skip to content

AnchorEnabledTagHelper

StrutTower edited this page Nov 11, 2022 · 6 revisions

Simple tag helper that will disable a link if the supplied boolean is false. This is done by adding the class disable-link. The CSS below is required.

Usage

<a href="#" asp-enabled="@Boolean">Link</a>

Output

<a href="#" class="disable-link">Link</a>

Attributes

Name Required Data Type Descirption
asp-enabled Required Boolean Boolean that sets if the link is enabled or not

CSS

Requires the following CSS class:

a.disable-link {
    pointer-events: none;
    cursor: default;
    color: [Your font color];
}

or using Sass:

a.disable-link {
    pointer-events: none;
    cursor: default;
    color: $body-color;
}