Skip to main content

angular material - How to use Badge with text

app.component.html

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


<h3>Text with a badge: Badge is not overlapped</h3>
<span 
  matBadge="4"
  matBadgeOverlap="false">
    My Score
</span>


<h3 style="margin-top:50px;">
  Text with a badge: Badge is overlapped
</h3>
<span 
  matBadge="8"
  matBadgeOverlap="true">
    Innne's Score
</span>
app.module.ts [import]

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