Ng-zorro-antd: Ability to have badges appear on menu icons

Created on 29 Nov 2018  路  1Comment  路  Source: NG-ZORRO/ng-zorro-antd

What problem does this feature solve?

Currently the menu does allow you to add a badge to an icon, but it breaks the formatting of the collapsed and expanded view of the menu. It would be nice to be able to show badges in the side menu of an application. An example of the problem :

https://stackblitz.com/edit/badge-in-menu-demo

Screenshots

collapsed view

screen shot 2018-11-29 at 11 43 27 am

expanded view

screen shot 2018-11-29 at 11 43 16 am

What does the proposed API look like?

Being able to wrap the anticon object in the <nz-badge [nzCount]="5"> tag like so:

<li nz-submenu [(nzOpen)]="openMap.sub1" (nzOpenChange)="openHandler('sub1')">
    <span title>
             <nz-badge [nzCount]="5">
                     <i class="anticon anticon-upload"></i>
              </nz-badge>
              <span>My Data</span>
     </span>
</li>
Ant Design Menu 馃寛 Feature Request

Most helpful comment

<li nz-submenu *ngIf="isAnyItem$ | async">
  <span title>
    <i nz-icon nzType="plus" nzTheme="outline"></i>
    <span>New</span>
    <nz-badge [nzCount]="totalEditedItems$ | async"  [nzStyle]="{transform: 'translate(15%, -25%)'}"
            ></nz-badge>
  </span>
</li>

image

image

>All comments

<li nz-submenu *ngIf="isAnyItem$ | async">
  <span title>
    <i nz-icon nzType="plus" nzTheme="outline"></i>
    <span>New</span>
    <nz-badge [nzCount]="totalEditedItems$ | async"  [nzStyle]="{transform: 'translate(15%, -25%)'}"
            ></nz-badge>
  </span>
</li>

image

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rafaelsmith picture rafaelsmith  路  3Comments

vthinkxie picture vthinkxie  路  3Comments

ismezy picture ismezy  路  3Comments

IonelLupu picture IonelLupu  路  3Comments

linjianhong picture linjianhong  路  3Comments