Angular Material 5 - Show full text in Mat Lists ( Word Wrap )
Simply wrap your whole paragraph inside of <mat-list-item>
with <p>
tags and that will force correct styles. Makes sense... No need for styles in this case.
<mat-list-item>
<p>
My super long text..........
</p>
</mat-list-item>
Use the following css:
::ng-deep .mat-list .mat-list-item .mat-line{
word-wrap: break-word;
white-space: pre-wrap;
}
or
::ng-deep .mat-line{
word-wrap: break-word !important;
white-space: pre-wrap !important;
}
Height of mat-list-item is limited to 48px so we need to override in case of large text
::ng-deep .mat-list .mat-list-item{
height:initial!important;
}
Demo:https://plnkr.co/edit/tTlhYgTkSz1QcgqjCfqh?p=preview
Link to know more about the word-wrap and white-spac