angular / angular/components

Material Icons are not centered vertically to parent

Open
#18,401 5 comments 6 reactions 0 assignees View on GitHub
area: material/button area: material/icon material spec P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### Reproduction

https://stackblitz.com/edit/angular-tzta8m

You will see that mat-icon is not centered vertically in button element.

#### Expected Behavior

Should be centered vertically, too.

#### Actual Behavior

Not centered, not so fancy.

#### Environment

- Angular, CDK/Material from Stackblitz:

```
"@angular/animations": "^8.2.9",
"@angular/cdk": "~8.2.2",
"@angular/common": "^8.2.9",
"@angular/compiler": "^8.2.9",
"@angular/core": "^8.2.9",
"@angular/forms": "^8.2.9",
"@angular/material": "~8.2.2",
"@angular/material-moment-adapter": "~8.2.2",
"@angular/platform-browser": "^8.2.9",
"@angular/platform-browser-dynamic": "^8.2.9",
"@angular/router": "^8.2.9",
"hammerjs": "^2.0.8",
"@angular-devkit/build-angular": "^0.803.8",
"@angular/cli": "^8.3.8",
"@angular/compiler-cli": "^8.2.9",
"@angular/language-service": "^8.2.9",
```

- Browser(s): Chrome Version 79.0.3945.130 (Official Build) (64-bit)
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 Enterprise 1903

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and inspect the Angular Material button and mat-icon behavior shown there. Confirm the vertical alignment problem in the stated Angular and Material versions; done means the icon is vertically centered within its button without breaking the reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.