Google Material Icons, Outlined, Rounded, Two-Tone, Sharp sets are not working
Asked Answered
A

2

10

I'm trying to use the Material Icons font from Google Outlined set that just came out, but I can't figure it out. There is no information nor documentation. Some icons are being displayed as filled and some as outlined.

eg: The account_circle icon from the Outlined set

How are you supposed to use the Outlined set? Any help is appreciated.

Academe answered 10/5, 2018 at 10:59 Comment(1)
Yes, you have reason when switch the Filled style option to Outline style don't change all icons appearance. Example: Filled icons //\\ Outlined iconsEvildoer
A
16

Update as of 2021

In short Google isn't (still) advertising the fact that you can load the different set via the Google API url on the Material Icons website. They are only, as per Google Material Icons instructions, talking about the default filled set which uses the following html tag to enqueue the Material Icons base stylesheet.

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

If you want to use the Outlined, the Two Tone, Round or Sharp sets, you need to add the following to the Material Icons url.

Theme URL parameters CSS class
Filled (Default) ?family=Material+Icons material-icons
Outlined ?family=Material+Icons+Outlined material-icons-outlined
Two Tone ?family=Material+Icons+Two+Tone material-icons-two-tone
Round ?family=Material+Icons+Round material-icons-round
Sharp ?family=Material+Icons+Sharp material-icons-sharp

Better performances

Like Google text-based font, Google Material Icons also accept the &display=swap url parameter.

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

You can learn more about &display=swap @ https://developers.google.com/web/updates/2016/02/font-display

You can also specify a <link rel="preconnect" tag in the <head> of your document to improve load performances.

<link rel="preconnect" href="https://fonts.gstatic.com">

Example

<!--head-->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Two+Tone&display=swap" rel="stylesheet">
<!--body-->
<span class="material-icons-two-tone">
account_circle
</span>
<span class="material-icons-two-tone">
check_circle
</span>
<span class="material-icons-two-tone">
favorite
</span>
Academe answered 3/1, 2021 at 14:18 Comment(0)
W
4

Update, with Answer:

Looking at the Readme in the source code, https://github.com/mui-org/material-ui/tree/master/packages/material-ui-icons

You Append Outline to the icon name. So for you:

import { AccountCircleOutline } from "@material-ui/icons";

or

import AccountCircleOutline from "@material-ui/icons/AccountCircleOutline";

I do believe this answers your question. A "correct answer" is always nice! Thanks!

Wiatt answered 20/6, 2018 at 23:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.