IconifyBundle 0.1.0
See the version list below for details.
dotnet add package IconifyBundle --version 0.1.0
NuGet\Install-Package IconifyBundle -Version 0.1.0
<PackageReference Include="IconifyBundle" Version="0.1.0" />
<PackageVersion Include="IconifyBundle" Version="0.1.0" />
<PackageReference Include="IconifyBundle" />
paket add IconifyBundle --version 0.1.0
#r "nuget: IconifyBundle, 0.1.0"
#:package IconifyBundle@0.1.0
#addin nuget:?package=IconifyBundle&version=0.1.0
#tool nuget:?package=IconifyBundle&version=0.1.0
IconifyBundle
Strongly-typed Iconify icons for .NET. Only the referenced icons are
bundled - either baked into the consuming assembly (Resource mode) or written to the build output as
.svg files (Disk mode). Blazor helpers included.
How it works
IconifyBundle— the core runtime (Icon,IconPack,SvgBuilder,IconRegistry).IconifyBundle.<Pack>— one NuGet per Iconify pack (e.g.IconifyBundle.Feather). Each pack ships a precompiled, strongly-typed class (e.g.Feather) with a member per icon (e.g.Feather.Activity), the pack's icon data (a build-time file, not embedded in the assembly), and the IconifyBundle source generator (as an analyzer). So a single reference to the pack suffices - it pulls theIconifyBundleruntime in transitively and runs the generator in the consuming project. These packages are produced on demand by thePackBuildertest, which downloads each pack from the Iconify data and packs it; they are not committed to source control.- The generator detects which icons are referenced (member accesses like
Feather.Activity) and materialises only those - so the pack assemblies stay tiny and the build only carries the icons in use.
Delivery
The two modes are mutually exclusive, selected by the IconifyBundleMode MSBuild property.
Resource mode (default)
The referenced icons are baked into the consuming assembly, so the generated API exposes string/stream
access with no files on disk (Feather.Activity.Svg, Feather.Activity.OpenStream()). Nothing to
configure - reference a pack and use it.
Disk mode
The referenced icons are written to the build and publish output as .svg files (under
iconifybundle/<prefix>/, e.g. to serve them as static assets), and the generated API additionally
exposes file paths (Feather.ActivityPath):
<PropertyGroup>
<IconifyBundleMode>Disk</IconifyBundleMode>
</PropertyGroup>
Feather.ActivityPath (and Feather.PathOf("activity")) return the path under the output directory.
The strongly-typed ...Path members require C# 14 (emitted as static extension properties).
Only icons referenced through the strongly-typed API are materialised. Dynamic, string-based lookups (
Feather.PathOf(name), theIconPackindexer) resolve only icons that were also referenced statically somewhere; otherwise they throw.This selection happens at compile time, not at trim or publish time. A
not materialisederror means the icon was never referenced through a member access the generator could see - not that trimming removed it. Materialised icons run their registration from a module initializer that the trimmer preserves.
Usage
Icon icon = Feather.Activity;
// full <svg> document
string svg = icon.Svg;
using Stream stream = icon.OpenStream();
The lower-level runtime API (the same Icon type the generated members return):
<a id='snippet-RuntimeUsage'></a>
// An Icon carries the inner SVG body and intrinsic size.
var icon = new Icon(
"activity",
"""<path stroke="currentColor" d="M12 2v20"/>""",
24,
24);
// full <svg> document
var svg = icon.Svg;
// UTF-8 stream of the SVG
using var stream = icon.OpenStream();
<sup><a href='/src/Tests/Snippets.cs#L6-L19' title='Snippet source file'>snippet source</a> | <a href='#snippet-RuntimeUsage' title='Start of snippet'>anchor</a></sup>
Blazor
@using IconifyBundle
<Iconify Value="Feather.Activity" Width="32" Height="32" class="text-primary" />
The <Iconify> component renders the icon as an inline <svg> (extra attributes like class/style
are splatted onto it). There is also an Icon.ToMarkup() extension returning a MarkupString.
Building locally
dotnet build src -c Release
src\PackBuilder\bin\Release\net10.0\PackBuilder.exe # downloads packs, builds IconifyBundle.<Pack> nugets
dotnet build IntegrationTests -c Release
dotnet build sample -c Release
Notes
https://github.com/iconify/icon-sets/blob/master/collections.md
NuGet packages
One NuGet per Iconify pack. The list is generated when the packs are built.
Note: some Iconify packs are not published because their license is incompatible with redistribution in a public, commercially-consumable NuGet:
Icon
Pattern designed by gira Park from The Noun Project.
| 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 is compatible. 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 is compatible. 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. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (220)
Showing the top 5 NuGet packages that depend on IconifyBundle:
| Package | Downloads |
|---|---|
|
IconifyBundle.SiGlyph
SmartIcons Glyph (799 icons) for IconifyBundle. |
|
|
IconifyBundle.Entypo
Entypo+ (321 icons) for IconifyBundle. |
|
|
IconifyBundle.Mi
Mono Icons (180 icons) for IconifyBundle. |
|
|
IconifyBundle.Flag
Flag Icons (542 icons) for IconifyBundle. |
|
|
IconifyBundle.VscodeIcons
VSCode Icons (1499 icons) for IconifyBundle. |
GitHub repositories
This package is not used by any popular GitHub repositories.