Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Material tabs not showing content

I'm trying to create a material tab group like this one in the Angular Material component documentation.

The problem I'm encountering is that the content of the tabs isn't loading/showing. I've copied the exact code from the docs, but still no luck.

The code I used:

<mat-tab-group>

  <mat-tab label="One">
    <h1>Some tab content</h1>
    <p>...</p>
  </mat-tab>

  <mat-tab label="Two">
    <h1>Some more tab content</h1>
    <p>...</p>
  </mat-tab>

</mat-tab-group>

I've recreated the issue on StackBlitz

like image 271
Niels Kersic Avatar asked Apr 14 '26 09:04

Niels Kersic


1 Answers

You need to import BrowserAnimationsModule in your app.module.ts file:

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

and add it to the imports array:

imports: [
    BrowserAnimationsModule,
    ...

Also you don't need to import NoopAnimationPlayer

See updated blitz.

like image 52
Sébastien Avatar answered Apr 17 '26 03:04

Sébastien



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!