【问题标题】:Adding custom CSS styling to Material UI KeyboardDatePicker向 Material UI KeyboardDatePicker 添加自定义 CSS 样式
【发布时间】:2022-01-25 19:05:12
【问题描述】:

我正在使用 Material UI KeyboardDatePicker。

我想去掉日期选择器中的黑线,正如您在屏幕截图中看到的那样。我该怎么做?

这是我的日期选择器的代码。

<KeyboardDatePicker
    error={this.state.quickRegFormErrors["dob"]||this.state.quickRegFormErrors["form_dob"] }
    helperText={(this.state.quickRegFormErrors["dob"] && "Date Of Birth is Required") || (this.state.quickRegFormErrors["form_dob"]) }
    required 
    id="dob" 
    name="dob" 
    style={{width:"80%", marginTop:"15px"}} 
    clearable
    value={this.state.dob}
    placeholder="dd/mm/yyyy"
    onChange={this.dateOnChange}
    format="dd/MM/yyyy"
    disableFuture= {true}
    autoOk={true}
    className="quick-reg-datepicker"
/>

【问题讨论】:

    标签: javascript css reactjs material-ui


    【解决方案1】:

    您可以在自定义 css 文件中删除该行。

     .quick-reg-datepicker .MuiInput-underline:before {
         content: none !important;
     }
     .quick-reg-datepicker .MuiInput-underline:after{
        content: none !important;
     }
    

    【讨论】:

      【解决方案2】:

      在您的日期 KeyboardDatePicker 或输入组件的样式属性中添加以下属性:

      border: none 
      
      style={{width:"80%", marginTop:"15px", border: none }} 
      

      【讨论】:

        【解决方案3】:

        你可以简单地添加这个道具来禁用这个底线:

        InputProps={{ disableUnderline: true }}
        

        【讨论】:

          猜你喜欢
          • 2021-07-14
          • 2021-04-12
          • 2020-07-16
          • 1970-01-01
          • 2012-12-30
          • 2021-12-01
          • 2019-05-04
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多