简体   繁体   English

如何从 reactstrap 输入覆盖表单控制 class?

[英]How can I override form-control class from a reactstrap input?

I have a reactstrap Input and I have the following issue: I need to override.form-control class or disable it, because otherwise my styles from styles.module.scss are not applied.我有一个 reactstrap 输入,我有以下问题:我需要覆盖.form-control class 或禁用它,否则我的 styles 来自 styles.module.scs How can I achieve this?我怎样才能做到这一点? I tried different specificity solutions but I can't get over.form-control class.. because I think it's computed last and overrides all my styles.我尝试了不同的特异性解决方案,但我无法克服。form-control class.. 因为我认为它是最后计算的,并覆盖了我所有的 styles。 If I put inline styles, it's ok, my styles are applied but this is not good practice, so I need to find a solution to apply my style from styles.module.scss.如果我放入内联 styles,没关系,我的 styles 被应用,但这不是好的做法,所以我需要从 styles 中找到一个解决方案来应用我的样式。 Any ideas?有任何想法吗?

<Input
  style={{
    fontSize: '18px',
    backgroundColor: 'ffffff',
    boxShadow: 'none',
    outline: 'none'
    }}
  type={'textarea'}
  id="clientInfo"
  name="clientInfo"
  defaultValue={formatValue(value)}
/>

You can use !important keyword to apply your custom style into .form-control class.您可以使用!important关键字将自定义样式应用到.form-control class。

Your input field:您的输入字段:

<Input
  className='form-control'
  type={'textarea'}
  id="clientInfo"
  name="clientInfo"
  defaultValue={formatValue(value)}
/>

Your CSS file:您的 CSS 文件:

 .form-control {
    fontSize: 18px !important;
    backgroundColor: #ffffff !important;
    boxShadow: none !important;
    outline: none !important;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React,Reactstrap-输入与输入,表单控制类阻止值提交,返回未定义 - React, Reactstrap - Input vs input, form-control class prevents values from submitting, returns undefined 如何删除React-Bootstrap中默认提供的FormControl组件的class =“ form-control” - How can I remove the class=“form-control” that comes by default the FormControl component in React-Bootstrap 让表单控件的值既来自props也来自用户输入 - Letting a form-control's value be both from props and from user input 如何在 reactstrap 输入上应用自定义 styles? - How can I apply custom styles on a reactstrap input? 如何知道 reactstrap 表单的输入/表单字段的状态? - How to know the state of input/form fields of reactstrap form? 如何检查从 ReactStrap 中选择了多选输入表单中的哪些选项 - How to check which options in a multi-select input form are selected from ReactStrap 我可以从reactstrap自定义CustomInput按钮吗? - Can I customize a CustomInput button from reactstrap? React hook 表单不适用于来自 reactstrap 的输入 - React hook form does not work with input from reactstrap 如何在 React 功能组件中使用 ReactStrap 获取表单/提交? - How Can I Get Form/Submit To Work with ReactStrap in a React functional component? 如何调整宽度<input> Reactstrap 中的元素? - How do I resize the width of <Input> element in Reactstrap?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM