Skip to content

bug(MatBadge/MatIcon): Number not showing in badge when used with icon, using custom theme  #28642

Closed
@neildeighan

Description

@neildeighan

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

Unknown

Description

Implementing a simple mat-icon with a matBadge="5", the number 5 is not shown in badge, it works ok when using one of the pre-defined themes i.e. Deep Purple & Amber, but when I select custom theme on adding angular/material, without changing the default colors, the number is not shown.

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-adgwky?file=src%2Fmain.ts
Steps to reproduce:

  1. ng new test-app (scss)
  2. ng add @angular/material ...
    ? Choose a prebuilt theme name, or "custom" for a custom theme: Custom
    ? Set up global Angular Material typography styles? Yes
    ? Include the Angular animations module? Include and enable animations
  1. imported MatIconModule & MatBadgeModule into app.component.ts
  2. Copied & pasted same code from https://material.angular.io/components/badge/examples (ts/html/css) to app.*

Expected Behavior

number is shown in badge when applied to mat-icon

Actual Behavior

badge is "blank"

Environment

  • Angular: 17.2.2
  • CDK/Material: 17.2.1
  • Browser(s): Chrome/Firefox/Stackblitz (not tried any others)
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaroundarea: cdk/schematicscdk/schematics is *not* a public API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions