Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 16 / Material Dialog title height LARGE when having component inside

After migrating to Angular 16 and Material MDC components we have a trouble with dialog titles that contain an element. It adds incredible amount of space to the top.

<div matDialogTitle class="tw-bg-debug-orange-light">
  <div class="tw-flex tw-flex-row tw-justify-between tw-items-center tw-bg-debug-sky-light">
    <span>Title</span>
    <mat-icon>close</mat-icon>
  </div>
</div>

looks like this

div as title

While having just plain h3:

<h2 matDialogTitle class="tw-bg-debug-orange-light">Hey</h2>

h3 as dialog title

It seems to be caused by this but attempts to override that in styles.scss are of no use as they get hammered by this being "higher" by material generated styles.

.mdc-dialog__title::before {
    display: inline-block; 
    width: 0;
    height: 40px;
    content: "";
    vertical-align: 0;
}

What would you do?

like image 456
PeS Avatar asked Sep 07 '26 10:09

PeS


1 Answers

if you want remove that. try this

.mdc-dialog__title::before {
    display: none;
}
like image 78
David Matos salvador Avatar answered Sep 10 '26 01:09

David Matos salvador