Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the default icon provider in Blazor app?

Tags:

c#

css

icons

blazor

When you first make a Blazor project, the default icon provider is Iconify, with their open icon pack.

How can I change the icon provider?

Most sites provide some JavaScript to include in an html page, which I don't use since I'm using a Blazor page.

What do I need to do to switch my provider over?

like image 775
BlazinBlazor Avatar asked Jan 09 '20 07:01

BlazinBlazor


People also ask

What icons does Blazor use?

Blazor Icons Library. The Syncfusion Blazor library provides the set of base64 formatted font icons which are being used in the Syncfusion Blazor components. These icons can be utilized in the web applications using SfIcon component or e-icons class.

Where can I find Blazor WebAssembly configuration files?

This topic applies to Blazor WebAssembly. For general guidance on ASP.NET Core app configuration, see Configuration in ASP.NET Core. Blazor WebAssembly loads configuration from the following app settings files by default: wwwroot/appsettings.json. wwwroot/appsettings.

Does don't Store app secrets in the configuration of a Blazor app?

Don't store app secrets, credentials, or any other sensitive data in the configuration or files of a Blazor WebAssembly app. The following example reads a configuration file ( cars.json) into the app's configuration. The following example uses a MemoryConfigurationSource in Program.cs to supply additional configuration.

Where are UI configuration values stored in Blazor?

In the following example, a UI configuration value is stored in an app settings file and loaded by the Blazor framework automatically. The value is read by a component. Inject an IConfiguration instance into a component to access the configuration data. Pages/ConfigurationExample.razor:

How to customize mudblazor’s default theme?

Let’s now learn how to customize our default theme. If you remember, we use the MudThemeProvider component, in the MainLayout.razor file, to make the MudBlazor components work properly. This theme provider provides all the default colors, sizes, shapes, and shadows for material components.


2 Answers

The icons are comming from @import url('open-iconic/font/css/open-iconic-bootstrap.min.css'); from site.css

Import different icons

I have used Material Icons

1.Imported material icon in site.css @import url('https://fonts.googleapis.com/icon?family=Material+Icons');

2.Use the Material Icons

Example:

<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
    <ul class="nav flex-column">
        <li class="nav-item px-3">
            <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
                <i class="material-icons">
                    accessibility
                </i> Home
            </NavLink>
        </li>
        <li class="nav-item px-3">
            <NavLink class="nav-link" href="counter">
                <i class="material-icons">autorenew</i>
                Counter
            </NavLink>
        </li>
    </ul>
</div>

enter image description here

like image 106
Rakesh T.R Avatar answered Oct 19 '22 19:10

Rakesh T.R


What worked for is to put the following link on the head tag, then I was able to get the icons

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

then access the icons like so

<i class="material-icons">face</i>

For more info check this document

like image 22
Siphamandla Hero Ngwenya Avatar answered Oct 19 '22 19:10

Siphamandla Hero Ngwenya