20

Is there any way to remove the box-shadow from mat-chips in Angular Material?

<mat-chip-list>
    <mat-chip>Papadum</mat-chip>
</mat-chip-list>

The chips appear to have a CSS style for the box-shadow, but disabling this style or overriding it doesn't work.

transition: box-shadow 280ms cubic-bezier(.4, 0, .2, 1);

I suspect there must be a simple way to disable this shadow, but I can't figure it out.

Edric
  • 24,639
  • 13
  • 81
  • 91
Daniel Kuhlwein
  • 582
  • 1
  • 4
  • 14

4 Answers4

40

To all new readers coming to read this post. Apply this class in your 'mat-chip' element to remove z index. This will remove shadow also.

class="mat-elevation-z0"
Deepak K J
  • 474
  • 6
  • 12
25

Adding the following CSS with !important did the trick:

mat-chip {
    transition: none !important;
    box-shadow: none !important;
}
Daniel Kuhlwein
  • 582
  • 1
  • 4
  • 14
8

No need for '!importants' this way

@import '~@angular/material/theming';

mat-chip {
    @include mat-elevation(0);
}
mukade
  • 650
  • 1
  • 9
  • 11
  • this is great way what about mat-fab since it is added to button – Dživo Jelić Mar 13 '20 at 00:02
  • @DživoJelić do something like this `.mat-fab:not([class*=mat-elevation-z]), .mat-mini-fab:not([class*=mat-elevation-z]) { box-shadow: 0px 3px 5px -1px rgb(0 0 0 /0%), 0px 6px 10px 0px rgb(0 0 0 / 0%), 0px 1px 18px 0px rgb(0 0 0 / 0%); }` – NoobCoder Aug 02 '21 at 11:13
2

Overriding styles didn't help me. I have used mat-basic-chip instead.

Docs says: "For a chip with no styles applied, use <mat-basic-chip>. You can then customize the chip appearance by adding your own CSS."

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Slaj
  • 21
  • 2