admin管理员组文章数量:1332890
In mat-select the options have too long strings, selected option should be shown in two lines in same dropdown.
Now the string looks inplete.
inplete string example
<mat-form-field class="form-field">
<mat-select formControlName="foo">
<mat-option value="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</mat-option>
</mat-select>
</mat-form-field>
I want somthing like this
example plete selected option
In mat-select the options have too long strings, selected option should be shown in two lines in same dropdown.
Now the string looks inplete.
inplete string example
<mat-form-field class="form-field">
<mat-select formControlName="foo">
<mat-option value="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</mat-option>
</mat-select>
</mat-form-field>
I want somthing like this
example plete selected option
Share Improve this question edited Jul 28, 2020 at 22:15 Joshua Villalobos asked Jul 27, 2020 at 18:34 Joshua VillalobosJoshua Villalobos 611 silver badge3 bronze badges 1- Does this answer your question? not enough space in <mat-select>. How to add multiple line <mat-option>? – Shabbir Dhangot Commented Jul 27, 2020 at 19:05
1 Answer
Reset to default 7There seem to be a few outdated answers.
As of Angular Material 11, you can do this easily by adapting the css of mat-option.
<mat-option class="multiline-mat-option">
<div>Line 1</div>
<div>Line 2</div>
</mat-option>
.multiline-mat-option.mat-option {
white-space: normal;
line-height: normal;
}
本文标签: javascriptHow to show data In two line in matselectStack Overflow
版权声明:本文标题:javascript - How to show data In two line in mat-select? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742312069a2451068.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论