How to add a badge to a icon inside a ion-button?

I need to add a badge to a ion icon inside a ion-button this way:

How could I do this with Ionic 2?


I was able to achieve this with some CSS:


    <button id="notification-button" ion-button clear>
        <ion-icon name="notifications">
          <ion-badge id="notifications-badge" color="danger">5</ion-badge>


  #notification-button {            
            position: relative;
            width: 42px;
            right: 1px;
            overflow: visible!important;

   #notifications-badge {
            background-color: red;
            position: absolute;
            top: -3px;
            right: -3px;
            border-radius: 100%;

I found it a bit easier this way (inside a <ion-navbar /> wrapped in <ion-buttons end />):

<button ion-button icon-only (click)="showNotifications()">
	<ion-badge *ngIf="n" color="accent">{{ n }}</ion-badge>
	<ion-icon name="notifications"></ion-icon>
button {
	ion-badge {
		position: absolute;
		top: -0.2rem;
		right: -0.2rem;
		opacity: 0.9;

		& ~ ion-icon {
			margin-right: 1.2rem;

bonjour svp comment vs avez fait pour la fonction je trouve pas bcp de doc sur les systèmes de notifications???

nice it’s work
Thanks bro

<ion-avatar slot="end" >
      <ion-badge style="position: absolute">5</ion-badge>
      <img [src]="member?.photoURL" />

Does it for me. Thank you for the code.

Is there a solution for Ionic 4? I prefer a more official way, instead of css “hacking”.

<ion-buttons slot="end">
    <ion-icon slot="icon-only" name="warning"></ion-icon>

(does not work)

This is an essential UI element. Ionic should provide it in an official way.

One workaround:

  <ion-icon size="large" name="warning"></ion-icon>

Just a button with a large icon and label text. It may not win a beauty contest.

Issue of an icon-only button: It’s overflow: hidden. You have to hack a bit. Also, you could use a own badge element. …