HeroiconsTagHelper 2.1.3

dotnet add package HeroiconsTagHelper --version 2.1.3
NuGet\Install-Package HeroiconsTagHelper -Version 2.1.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HeroiconsTagHelper" Version="2.1.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HeroiconsTagHelper --version 2.1.3
#r "nuget: HeroiconsTagHelper, 2.1.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HeroiconsTagHelper as a Cake Addin
#addin nuget:?package=HeroiconsTagHelper&version=2.1.3

// Install HeroiconsTagHelper as a Cake Tool
#tool nuget:?package=HeroiconsTagHelper&version=2.1.3

<img src="assets/logo.svg" align="left" height="45"> heroicons-tag-helper

CI build status NuGet Package GitHub Package Registry Project license

ASP.NET tag helper for adding Heroicons to your razor views.

Installation

[!NOTE] This package's version is aligned with the heroicons NPM package so you always know which version you're using.

dotnet add package HeroiconsTagHelper

CI builds can be downloaded from the packages page or the GitHub feed. They're also available as build artifacts on every PR.

Setup

In your _ViewImports.cshtml add:

@addTagHelper *, HeroiconsTagHelper

In your Startup.cs add:

public void ConfigureServices(IServiceCollection services)
{
    services.AddHeroicons(Configuration);
}

In your appsettings.json add:

{
  "Heroicons": {
    "IncludeComments": true,
    "SetAccessibilityAttributes": true,
    "SetFocusableAttribute": true
  }
}

Settings

Name Default Value Description
IncludeComments false Add an html comment before the svg tag with the style and name of the icon to help make development/debugging easier.
SetAccessibilityAttributes false Adds various accessibility attributes based on the default state of the tag.
SetFocusableAttribute false Adds the focusable attribute set to false to prevent the icon from receiving focus in Internet Explorer and Edge Legacy.

SetAccessibilityAttributes

If aria-label or aria-labeledby are set then the icon is being used as an image so role="img" will be added to the svg tag, otherwise aria-hidden="true" will be added.

Note: If the element already contains an aria-hidden or role attribute then it will not be modified.

Usage

There are two versions of the tag helper which are used to pick between the outline and solid icon styles.

<heroicon-outline icon="Sun" class="h-6 w-6 text-orange-500" />

will output

<svg class="h-6 w-6 text-orange-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
</svg>
<heroicon-solid icon="Sun" class="h-6 w-6 text-orange-500" />

will output

<svg class="h-6 w-6 text-orange-500" fill="currentColor" viewBox="0 0 20 20">
    <path fill-rule="evenodd" d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z" clip-rule="evenodd" />
</svg>

Development

This project uses the run-script dotnet tool to manage its build and test scripts. To use this you'll need to run dotnet tool install and then dotnet r to see the available commands or look at the scripts section in the global.json.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on HeroiconsTagHelper:

Package Downloads
Pines.TagHelpers

Adds ASP.NET Core tag helpers to make use of the Pines Alpine.js + Tailwind CSS UI components library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.3 110 4/7/2024
2.1.2 60 4/7/2024
2.1.1 63 4/7/2024
2.1.0 60 4/7/2024
2.0.18 4,460 7/2/2023
2.0.17 136 7/2/2023
2.0.16 143 7/2/2023
2.0.15 3,554 2/14/2023
2.0.14 235 2/14/2023
2.0.13 1,911 11/13/2022
2.0.12 886 10/12/2022
2.0.11 391 10/12/2022
2.0.10 382 10/12/2022
2.0.9 390 10/11/2022
2.0.8 568 10/11/2022
2.0.7 386 10/11/2022
2.0.6 382 10/11/2022
2.0.5 376 10/11/2022
2.0.4 388 10/11/2022
2.0.3 489 10/11/2022
1.0.6 2,144 3/15/2022
1.0.5 1,526 11/7/2021
1.0.4 438 8/19/2021
1.0.2 362 7/23/2021
1.0.1 482 4/21/2021
1.0.0 339 4/21/2021
0.4.2 353 4/21/2021
0.4.2-beta.61 137 4/21/2021
0.4.2-beta.42 741 12/4/2020
0.4.2-beta.38 276 11/14/2020
0.4.2-beta.30 226 10/28/2020