Graphnode.BlazorIconify 0.2.0-alpha

This is a prerelease version of Graphnode.BlazorIconify.
dotnet add package Graphnode.BlazorIconify --version 0.2.0-alpha
                    
NuGet\Install-Package Graphnode.BlazorIconify -Version 0.2.0-alpha
                    
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="Graphnode.BlazorIconify" Version="0.2.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Graphnode.BlazorIconify" Version="0.2.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Graphnode.BlazorIconify" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Graphnode.BlazorIconify --version 0.2.0-alpha
                    
#r "nuget: Graphnode.BlazorIconify, 0.2.0-alpha"
                    
#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.
#:package Graphnode.BlazorIconify@0.2.0-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Graphnode.BlazorIconify&version=0.2.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Graphnode.BlazorIconify&version=0.2.0-alpha&prerelease
                    
Install as a Cake Tool

Graphnode.BlazorIconify

Unofficial, experimental Iconify support for Blazor
Uses source generators to embed icon data at build time for fast, offline-friendly rendering.

Features

  • <Iconify> component for easy use in Blazor apps
  • Icons are embedded in your app via source generators (no runtime fetches for static icon names)
  • Falls back to web requests for dynamic icon names
  • No JavaScript interop required

Installation

Install the package Graphnode.BlazorIconify from NuGet.

Add the service in your Program.cs:

using Graphnode.BlazorIconify;

builder.Services.AddBlazorIconify();

Note: If it can't resolve AddBlazorIconify it's because the source generator did not run.

You can configure the service with options (shown with default values):

builder.Services.AddBlazorIconify(options =>
{
    // Allow remote fetching for icons not embedded at build time
    options.EnableRemoteFetching = true;
    
    // Set the remote API URL for fetching icons
    options.RemoteApiUrl = "https://api.iconify.design";
    
    // Throw an exception if the icon is not found in the source cache and remote fetching fails or is disabled.
    options.ThrowIfIconNotFound = false;
});

Then add the import in your _Imports.razor or in the component where you want to use it:

@using Graphnode.BlazorIconify

Usage

Use the <Iconify> component in your Blazor app to render icons. You can specify the icon name using the Name parameter.

<Iconify Name="mdi:home" />

This will render the icon as a <svg> element. The icon name should be in the format prefix:name, where prefix is the icon set (e.g., mdi for Material Design Icons) and name is the specific icon name.

Any attributes you pass to the component will be passed to the <svg> element. For example, you can set the class and style attributes like this:

<Iconify Name="mdi:home" class="my-icon" style="width: 24px; height: 24px;" />

For dynamic icon names, web fetches will be used as a fallback:

<Iconify Name="@iconName" />

Notes

  • This is unofficial and not affiliated with the Iconify project.
  • It's experimental, behavior may change and might break.

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0-alpha 138 4/2/2025
0.1.0-alpha 126 4/2/2025