How to make a 'Select' component as required in Material UI (React JS)

前端 未结 2 1771
伪装坚强ぢ
伪装坚强ぢ 2021-02-07 12:53

I want to display like an error with red color unless there is a selected option. Is there any way to do it.

2条回答
  •  悲&欢浪女
    2021-02-07 13:12

    Material UI has other types of Select(native) also where you can just use plain HTML required attribute to mark the element as required.

    
      Name
      
    
    

    P.S. https://material-ui.com/demos/selects/#native-select

提交回复
热议问题