Skip to main content

BadIdeas.Icons.FontAwesome by Phil Scott

NuGet / site data​

Nuget GitHub last commit GitHub Repo stars

Details​

Info​

info

Name: BadIdeas.Icons.FontAwesome

Package Description

Author: Phil Scott

NuGet: https://www.nuget.org/packages/BadIdeas.Icons.FontAwesome/

You can find more details at https://github.com/phil-scott-78/Icons/

Source: https://github.com/phil-scott-78/Icons/

Author​

note

Phil Scott Alt text

Original Readme​

note

BadIdeas.Icons

I had a bad idea about building out all the icons in Font Awesome in a huge blazor assembly and relying on dotnet trimming to keep the file size low.

This is the result.

Install​

dotnet add package BadIdeas.Icons.FontAwesome 

Use​

All the icons are components in the Icon namespace. They have zero styling, so you'll need to apply a width and a fill color with whatever CSS library you're into.

@using BadIdeas.FontAwesome.Icons

<Icon Data="Brands.Github()" class="...your styling..."> </Icon>

Neat​

This will render the svg for the GitHub icon. No external javascript or CSS is needed for this, just a few KBs for the SVG content. And because of the assembly trimming, only the SVGs that are needed are deployed.

About​

note

generate font awesome icons

How to use​

Example (source csproj, source files)​

This is the CSharp Project that references BadIdeas.Icons.FontAwesome

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BadIdeas.Icons.FontAwesome" Version="0.0.0-alpha.0.21" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.8" PrivateAssets="all" />
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>

Generated Files​

Those are taken from $(BaseIntermediateOutputPath)\GX

#pragma checksum "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ca69fbc161c0130d6d7831728befc975abb17b04491a271bc49266261055543b"
// <auto-generated/>
#pragma warning disable 1591
namespace DemoBlazor
{
#line default
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.Threading.Tasks;
using global::Microsoft.AspNetCore.Components;
#nullable restore
#line (1,2)-(1,23) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using System.Net.Http

#nullable disable
;
#nullable restore
#line (2,2)-(2,28) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using System.Net.Http.Json

#nullable disable
;
#nullable restore
#line (3,2)-(3,45) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using Microsoft.AspNetCore.Components.Forms

#nullable disable
;
#nullable restore
#line (4,2)-(4,47) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using Microsoft.AspNetCore.Components.Routing

#nullable disable
;
#nullable restore
#line (5,2)-(5,43) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using Microsoft.AspNetCore.Components.Web

#nullable disable
;
#nullable restore
#line (6,2)-(6,58) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using Microsoft.AspNetCore.Components.Web.Virtualization

#nullable disable
;
#nullable restore
#line (7,2)-(7,56) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using Microsoft.AspNetCore.Components.WebAssembly.Http

#nullable disable
;
#nullable restore
#line (8,2)-(8,27) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using Microsoft.JSInterop

#nullable disable
;
#nullable restore
#line (9,2)-(9,18) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using DemoBlazor

#nullable disable
;
#nullable restore
#line (10,2)-(10,25) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\_Imports.razor"
using DemoBlazor.Layout

#nullable disable
;
#line default
#line hidden
#nullable restore
public partial class App : global::Microsoft.AspNetCore.Components.ComponentBase
#nullable disable
{
#pragma warning disable 1998
protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
{
__builder.OpenComponent<global::Microsoft.AspNetCore.Components.Routing.Router>(0);
__builder.AddComponentParameter(1, nameof(global::Microsoft.AspNetCore.Components.Routing.Router.
#nullable restore
#line (1,9)-(1,20) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
AppAssembly

#line default
#line hidden
#nullable disable
), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Reflection.Assembly>(
#nullable restore
#line (1,23)-(1,43) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
typeof(App).Assembly

#line default
#line hidden
#nullable disable
));
__builder.AddAttribute(2, "Found", (global::Microsoft.AspNetCore.Components.RenderFragment<global::Microsoft.AspNetCore.Components.RouteData>)((routeData) => (__builder2) => {
__builder2.OpenComponent<global::Microsoft.AspNetCore.Components.RouteView>(3);
__builder2.AddComponentParameter(4, nameof(global::Microsoft.AspNetCore.Components.RouteView.
#nullable restore
#line (3,20)-(3,29) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
RouteData

#line default
#line hidden
#nullable disable
), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Microsoft.AspNetCore.Components.RouteData>(
#nullable restore
#line (3,32)-(3,41) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
routeData

#line default
#line hidden
#nullable disable
));
__builder2.AddComponentParameter(5, nameof(global::Microsoft.AspNetCore.Components.RouteView.
#nullable restore
#line (3,43)-(3,56) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
DefaultLayout

#line default
#line hidden
#nullable disable
), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Type>(
#nullable restore
#line (3,59)-(3,77) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
typeof(MainLayout)

#line default
#line hidden
#nullable disable
));
__builder2.CloseComponent();
__builder2.AddMarkupContent(6, "\r\n ");
__builder2.OpenComponent<global::Microsoft.AspNetCore.Components.Routing.FocusOnNavigate>(7);
__builder2.AddComponentParameter(8, nameof(global::Microsoft.AspNetCore.Components.Routing.FocusOnNavigate.
#nullable restore
#line (4,26)-(4,35) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
RouteData

#line default
#line hidden
#nullable disable
), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::Microsoft.AspNetCore.Components.RouteData>(
#nullable restore
#line (4,38)-(4,47) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
routeData

#line default
#line hidden
#nullable disable
));
__builder2.AddComponentParameter(9, nameof(global::Microsoft.AspNetCore.Components.Routing.FocusOnNavigate.
#nullable restore
#line (4,49)-(4,57) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
Selector

#line default
#line hidden
#nullable disable
), "h1");
__builder2.CloseComponent();
}
));
__builder.AddAttribute(10, "NotFound", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
__builder2.OpenComponent<global::Microsoft.AspNetCore.Components.Web.PageTitle>(11);
__builder2.AddAttribute(12, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
__builder3.AddContent(13, "Not found");
}
));
__builder2.CloseComponent();
__builder2.AddMarkupContent(14, "\r\n ");
__builder2.OpenComponent<global::Microsoft.AspNetCore.Components.LayoutView>(15);
__builder2.AddComponentParameter(16, nameof(global::Microsoft.AspNetCore.Components.LayoutView.
#nullable restore
#line (8,21)-(8,27) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
Layout

#line default
#line hidden
#nullable disable
), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<global::System.Type>(
#nullable restore
#line (8,30)-(8,48) "D:\gth\RSCG_Examples\v2\rscg_examples\BadIdeas.Icons.FontAwesome\src\DemoBlazor\DemoBlazor\App.razor"
typeof(MainLayout)

#line default
#line hidden
#nullable disable
));
__builder2.AddAttribute(17, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
__builder3.AddMarkupContent(18, "<p role=\"alert\">Sorry, there\'s nothing at this address.</p>");
}
));
__builder2.CloseComponent();
}
));
__builder.CloseComponent();
}
#pragma warning restore 1998
}
}
#pragma warning restore 1591

Useful​

Download Example (.NET C#)​

Share BadIdeas.Icons.FontAwesome​

https://ignatandrei.github.io/RSCG_Examples/v2/docs/BadIdeas.Icons.FontAwesome

aaa

Category "Blazor" has the following generators:​

1 BadIdeas.Icons.FontAwesome Nuget GitHub Repo stars 2025-08-03

2 Blazor.TSRuntime Nuget GitHub Repo stars 2025-08-02

3 Blazorators Nuget GitHub Repo stars 2024-01-22

4 BlazorOcticons Nuget GitHub Repo stars 2025-12-14

5 GoLive.Generator.BlazorInterop Nuget GitHub Repo stars 2024-11-09

See category​

Blazor