app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styles: [`
.mat-badge-content {
width: auto;
display: grid;
min-width: 40px;
min-height: 36px;
text-align: center;
align-items: center;
padding: 5px 3px;
margin-top:-28px;
margin-right: -16px;
}
`]
})
export class AppComponent { }
app.component.html
<h2 style="padding-top:25px; padding-bottom:50px;">
Angular Material - How to use custom Badge size
</h2>
<span
matBadge="15"
matBadgeOverlap="false">
Custom size badge
</span>
app.module.ts [import]
import { MatBadgeModule } from '@angular/material/badge'
- angular material - How to align Tabs
- angular material - How to disable Tabs content animation
- angular material - How to generate Tabs programmatically
- angular material - How to create & add Tab programmatically
- angular material - How to use Slider
- angular material - Slider step, minimum & maximum value
- angular material - How to use Slider input event
- angular material - How to use Slide toggle
- angular material - How to change Slide toggle checked color
- angular material - How to use Badge with text
- angular material - How to change Badge size
- angular material - How to show custom color in Badge
- angular material - How to show Badge in a button
- angular material - How to show Badge with icon
- angular material - Badge position before & below after