Skip to content

<mat-icon svgIcon="icon_name"> does not resize #16293

Closed
@domsew

Description

@domsew

Reproduction and Description

When I use standard icons from Getting started I can easily change size of any icon, by changing css font-size property.
However in my angular material app I use icons from
https://dev.materialdesignicons.com/getting-started/angular#angular-material
to change size in this case I should set css width and height properties. Unfortunately size of icon remains the same. The workaround is, to set transform: scale(x).

To avoid workaround, <svg> should have viewBox="0 0 x y" attribute. It can be added here but the problem is to set default viewBox for MatIconRegistry. In my case it will always be viewBox="0 0 24 24"

Expected Behavior

Icon should resize.

Actual Behavior

Icon does not resize.

Environment

  • Angular: 7
  • CDK/Material: 7
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 7

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions