Graphnode.BlazorIconify
0.2.0-alpha
dotnet add package Graphnode.BlazorIconify --version 0.2.0-alpha
NuGet\Install-Package Graphnode.BlazorIconify -Version 0.2.0-alpha
<PackageReference Include="Graphnode.BlazorIconify" Version="0.2.0-alpha" />
<PackageVersion Include="Graphnode.BlazorIconify" Version="0.2.0-alpha" />
<PackageReference Include="Graphnode.BlazorIconify" />
paket add Graphnode.BlazorIconify --version 0.2.0-alpha
#r "nuget: Graphnode.BlazorIconify, 0.2.0-alpha"
#:package Graphnode.BlazorIconify@0.2.0-alpha
#addin nuget:?package=Graphnode.BlazorIconify&version=0.2.0-alpha&prerelease
#tool nuget:?package=Graphnode.BlazorIconify&version=0.2.0-alpha&prerelease
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 | Versions 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. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.14)
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 |