How to make mat-checkbox like a radio button

荒凉一梦 提交于 2021-01-28 06:01:54

问题


I have a mat-checkbox in the angular project. How to make a mat-checkbox can only be selected one. (No more than one). Here's the code I have:

<mat-checkbox>Pre Order</mat-checkbox>
<mat-checkbox>Order</mat-checkbox>

Can anyone help? I want the mat-checkbox to behave like a mat-radio-button.


回答1:


Just to get the correct answer:

  1. Use the mat-radio-button
  2. Set border-radius: 0%; for .mat-radio-outer-circle css class

And that's it!

Cheers!



来源:https://stackoverflow.com/questions/60143309/how-to-make-mat-checkbox-like-a-radio-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!