Use the Bootstrap Icons library as Blazor components. This solution is inspired by React Bootstrap Icons.
dotnet add package Blazor.Bootstrap.Icons
@using Blazor.Bootstrap.Icons.Components
<BiArrowRight />
To make icons available globally in your project, you can add @using Blazor.Bootstrap.Icons.Components
to your _Imports.razor
file.
The icon names are the PascalCase
version of the original name. To avoid conflicts with any other components in your project, all component names start with the prefix Bi
.
Attribute | Default value |
---|---|
Class |
"bi bi-" + icon name (e.g. bi-arrow-right ) |
Color |
"currentColor" \ |
Size |
"1em" |
You can add any other attribute like title
, it will be attached to the SVG element.
Other ways to use Bootstrap Icons: https://icons.getbootstrap.com/#usage