Components: mat-icon: Choose between Filled, Outlined, Rounded, Two-Tone and Sharp icons;

Created on 16 Jan 2019  路  4Comments  路  Source: angular/components

Please describe the feature you would like to request.

To be able to select between Filled, Outlined, Rounded, Two-Tone and Sharp when using mat-icon;

What is the use-case or motivation for this proposal?

An easy way to use the new icons available on https://material.io/tools/icons/?style=baseline (without having to manually put the SVG's of the icons you want)

P4 materiaicon feature

Most helpful comment

Hi,
I've just been playing around with this and it seems like there is already a way to do this more easily.

You need to do two things:

  1. Change the font url to add the alternative styles you want to use. For example:
    https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp

  2. Use the fontSet attribute on <mat-icon> to specify the style you want to apply. Here's an example to display a round home icon: <mat-icon fontSet="material-icons-round">home</mat-icon>.

Not as straight-forward as writing <mat-icon>home_round</mat-icon>, but I can definitely live with that. Wouldn't hurt mentioning this solution in the docs though.

In the meantime, hope this will help 馃槂

All 4 comments

This seems partly supported, but not for all icons.
e.g. Delete and Label have an outline version by using delete_outline as label, but print and edit do not have an oultine version available in angular material.

Hi!
Some news?

<mat-icon appearance="outline">mail</mat-icon>

as well as? https://material.angular.io/components/form-field/overview#form-field-appearance-variants
:3

Hi,
I've just been playing around with this and it seems like there is already a way to do this more easily.

You need to do two things:

  1. Change the font url to add the alternative styles you want to use. For example:
    https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp

  2. Use the fontSet attribute on <mat-icon> to specify the style you want to apply. Here's an example to display a round home icon: <mat-icon fontSet="material-icons-round">home</mat-icon>.

Not as straight-forward as writing <mat-icon>home_round</mat-icon>, but I can definitely live with that. Wouldn't hurt mentioning this solution in the docs though.

In the meantime, hope this will help 馃槂

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RoxKilly picture RoxKilly  路  3Comments

Miiekeee picture Miiekeee  路  3Comments

jelbourn picture jelbourn  路  3Comments

julianobrasil picture julianobrasil  路  3Comments

michaelb-01 picture michaelb-01  路  3Comments