Skip to content

bug(mat-table): Unable to use mat-table-row-item-container-height #30906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
melroy89 opened this issue Apr 19, 2025 · 1 comment · Fixed by #30978
Closed

bug(mat-table): Unable to use mat-table-row-item-container-height #30906

melroy89 opened this issue Apr 19, 2025 · 1 comment · Fixed by #30978
Assignees
Labels
area: material/table P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@melroy89
Copy link

melroy89 commented Apr 19, 2025

Description

As discussed earlier here: #26438 (closed)

height: unset; is done on purpose: https://github.com/angular/components/blob/204b289588106d90c991f26a50c23c80c68d4fc3/src/material/table/table.scss#L150C11-L150C16

However, why does Material 3 have tokens to allow to you change those heights: https://material.angular.io/components/table/styling..?

Like: row-item-container-height, header-container-height etc. But they will NOT work...

Reproduction

  1. Try to use:
  @include mat.table-overrides((
    header-container-height: 32px,
    row-item-container-height: 32px,
    footer-container-height: 32px
  ));
  1. You will notice it won't work at all

Expected Behavior

  • Either support these mixins like shown above.
  • Or: Remove the token support from it?

Actual Behavior

You provide style override tokens, but it's not working at all. Its very confusing.

Environment

  • Angular: 19.x
  • CDK/Material: 19.x
  • Browser(s): Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu
@melroy89 melroy89 added the needs triage This issue needs to be triaged by the team label Apr 19, 2025
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/table and removed needs triage This issue needs to be triaged by the team labels Apr 29, 2025
@crisbeto
Copy link
Member

It looks like the tokens currently only apply to the native table, but not the flexbox-based one. The flexbox table has a hardcoded height: https://github.com/angular/components/blob/main/src/material/table/_table-flex-styles.scss#L3. Fixing it is fairly straightforward, but I expect this will be difficult to land internally. There are a couple of ways to work around it:

  1. Switch to using the native MatTable.
  2. Add the following style to your app:
mat-header-row {
  min-height: var(--mat-table-header-container-height);
}

mat-row {
  min-height: var(--mat-table-row-item-container-height);
}

mat-footer-row {
  min-height: var(--mat-table-footer-container-height);
}

@crisbeto crisbeto self-assigned this Apr 29, 2025
crisbeto added a commit to crisbeto/material2 that referenced this issue Apr 29, 2025
Fixes that the flexbox-based table had a hardcoded height for the rows, instead of using the tokens.

Fixes angular#30906.
crisbeto added a commit that referenced this issue Apr 29, 2025
Fixes that the flexbox-based table had a hardcoded height for the rows, instead of using the tokens.

Fixes #30906.
crisbeto added a commit that referenced this issue Apr 29, 2025
Fixes that the flexbox-based table had a hardcoded height for the rows, instead of using the tokens.

Fixes #30906.

(cherry picked from commit 50a9a9b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/table P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants