I have this HTML code here
<div style="width: 150px">
<form class="example-form">
<mat-form-field class="example-full-width">
<input type="text" placeholder="Assignee" aria-label="Assignee" matInput [formControl]="myControl" [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn">
<mat-option *ngFor="let option of filteredOptions | async" [value]="option">
{{option.name}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
</form>
</div>
The default behaviour of mat-option
is using
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
I want to break the long sentence into next line rather than using ...
. The styling wont work :(
I also need to override the font which I tried also using below code, but it wont override
mat-option {
font-family: "Times New Roman", Times, serif; // does not work
}
styling here
Please help.
You can add this to your CSS:
.mat-option{
word-wrap:break-word !important;
white-space:normal !important;
font-family: "Times New Roman", Times, serif;
}
.mat-option-text{
line-height:initial !important;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With