Skip to main content

angular material - How to show Badge with icon

app.component.html

<h2 style="padding-top:25px; padding-bottom:25px;">
  Angular Material - How to show Badge with icon
</h2>

<h3>Default size badge</h3>
<mat-icon matBadge="9" matBadgeColor="warn">
  cloud
</mat-icon>

<h3>Badge no overlap</h3>
<mat-icon matBadge="9" matBadgeOverlap="false">
  cloud
</mat-icon>

<h3>Small size badge</h3>
<mat-icon matBadge="9" matBadgeSize="small">
  cloud
</mat-icon>

<h3>Badge position before</h3>
<mat-icon matBadge="9" matBadgePosition="before">
  cloud
</mat-icon>
app.module.ts [import]

import { MatBadgeModule } from '@angular/material/badge'
import { MatIconModule } from '@angular/material/icon';
More Angular tutorials