Skip to content

bug(material/button): incorrect alignment of svg icons #31576

@Lutsykm

Description

@Lutsykm

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

20.0.5

Description

After update to angular/material 20.1.+

Material buttons with icons no longer align properly.


Before

Image

After

Image

What causing an issue?

After removing min-height, everything works as before.
My icon size is 24px, but with min-height: fit-content, the .mat-icon container gets stretched while the SVG icon remains the same size.

For example:

  • .mat-icon: 24px × 29px
  • svg: 24px × 24px

This causes vertical misalignment of icons compared to previous versions.

Image

I believe this PR is the cause of this issue.: #30891
commit -> 87b6962


Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

Expected Behavior

The .mat-icon inside .mat-mdc-button-base should remain properly aligned and not stretch vertically.
The mat-icon container should match the size of the SVG icon (24px × 24px) when the icon size is set to 24px.

Actual Behavior

With min-height: fit-content; applied, the .mat-icon container stretches vertically (e.g., 24px × 29px) while the SVG icon stays 24px × 24px.
This causes misalignment and extra spacing around the icon compared to previous versions.

Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/button

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions