I was working recently on the similar situation and solution/explanation is following:
For the first, this situation is the same with any situation where we need to have ellipsis, only difference is that containers in mat-expansion are display: flex;
To make ellipsis working generally we have 2 ways:
- Single line solution
- Multiline solution with complicated
tricks and using
:after
but I don't like these solutions and will focus on single line text with ellipsis
Solutions for Material Expansion panel:
display: block;
for mat-panel-description, Existing topic:
Text overflow ellipsis dynamic width inside an angular material extension panel description
- Keep it
display: flex
and set min-width: 0;
for mat-expansion-panel-header-title, I like this solution a lot.
Existing topic: Ellipsis in flexbox container
So I forked your code and implemented my suggestion.
https://angular-4s7pfw-wrmxo1.stackblitz.io
Result:
