Blazicons 2.0.28
dotnet add package Blazicons --version 2.0.28
NuGet\Install-Package Blazicons -Version 2.0.28
<PackageReference Include="Blazicons" Version="2.0.28" />
paket add Blazicons --version 2.0.28
#r "nuget: Blazicons, 2.0.28"
// Install Blazicons as a Cake Addin #addin nuget:?package=Blazicons&version=2.0.28 // Install Blazicons as a Cake Tool #tool nuget:?package=Blazicons&version=2.0.28
Blazicons
Provides support for displaying SVG based icons in Blazor projects.
Check out the Demo Site.
Overview
Blazicons is a simple library consisting of one Blazor component, the Blazicon. A Blazicon component displays an SVG icon similar to how a font icon would be displayed.
Why Blazicons?
Why not just use font libraries to display icons? Blazicons provides a couple of benefits over using font icon libraries.
The first benefit is resource size. Blazicons is desinged to leverage the SVG versions of the icons from popular icon libraries. Given Blazor's assembly trimming, only the icons used, rather than the entire library of icons are delivered to the client.
With Blazicons, an additional benifit is the ability to leverage intellisense. The various icons available in a given icon library are displayed with Visual Studio's intellisense options.
Getting Started
To get started using Blazicons, just install the Blazicons NuGet package of the desired icon library. The following options are currently among those available.
- Blazicons.Bootstrap
- Blazicons.Devicon
- Blazicons.FluentUI
- Blazicons.FontAwesome
- Blazicons.GoogleMaterialDesign
- Blazicons.Ionicons
- Blazicons.Lucide
- Blazicons.MaterialDesignIcons
Next add the Blazicons reference to the _Imports.razor
file in the Blazor project.
@using Blazicons
Ensure that the project styles.css file is referenced in the head tag section of the index.html/_Host.cshtml file.
<link href="My.App.styles.css" rel="stylesheet" />
Finally, add the Blazicon component to your Blazor pages/components.
<Blazicon Svg="MdiIcon.Information"></Blazicon>
Parameters
Each parameter in a Blazor component has a rendering cost. Since it might be desireable to have many Blazicons on a page, maybe even in some sort of repeater control, one of the core principal when creating Blazicons was to limit the number of parameters.
As a result, a Blazicon only has one parameter, Svg
. The Svg
parameter is a special type of SvgIcon
. These SvgIcon
types are defined in the specific icon library Blazicon files.
Styling
A Blazicon is designed to be displayed with the size and color determined by current font size and color settings. Therefore, the size and color can easily be changed by adjusting the CSS font-size
and color
style attributes of the containing element.
<div style="font-size 200%; color: #f00;">
<Blazicon Svg="Ionicon.ShapesSharp"></Blazicon>
</div>
Styling helper methods also are available on the SvgIcon
object.
<Blazicon Svg='Ionicon.ShapesSharp.WithColor("#f00").WithSize("200%")'></Blazicon>
Product | Versions 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 was computed. 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. |
-
net6.0
- BlazorComponentUtilities (>= 1.8.0)
- Microsoft.AspNetCore.Components.Web (>= 6.0.29)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on Blazicons:
Package | Downloads |
---|---|
Blazicons.MaterialDesignIcons
Provides the Material Design Icons icon library packaged as Blazicons, SVG icon components for Blazor. |
|
Blazicons.FluentUI
Provides the Fluent UI icon library packaged as Blazicons, SVG icon components for Blazor. |
|
Blazicons.Ionicons
Provides the Ionicons icon library packaged as Blazicons, SVG icon components for Blazor. |
|
Blazicons.FontAwesome
Provides the Font Awesome icon library packaged as Blazicons, SVG icon components for Blazor. |
|
Blazicons.Bootstrap
Provides the Bootstrap icon library packaged as Blazicons, SVG icon components for Blazor. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.28 | 15,608 | 4/28/2024 |
2.0.28-beta | 99 | 4/28/2024 |
2.0.26-alpha | 111 | 4/24/2024 |
2.0.24-alpha | 113 | 4/11/2024 |
2.0.23-alpha | 112 | 4/11/2024 |
2.0.22-alpha | 109 | 4/10/2024 |
1.2.20 | 7,019 | 10/30/2023 |
1.2.20-beta | 123 | 10/30/2023 |
1.1.17-beta | 186 | 5/10/2023 |
1.1.14 | 4,297 | 1/24/2023 |
1.1.14-beta | 188 | 1/24/2023 |
1.1.12-alpha | 172 | 1/23/2023 |
1.0.10 | 897 | 1/3/2023 |
1.0.10-beta | 197 | 1/3/2023 |
1.0.8-alpha | 306 | 1/2/2023 |
1.0.7-alpha | 167 | 1/2/2023 |
1.0.6-alpha | 169 | 1/2/2023 |
0.1.3-alpha | 306 | 12/22/2022 |