How to change the underline color of the input component in MD Bootstrap

Anmol Sarraf :

So I'm using the Input Group Component from MDBootstrap.

I was wondering if there's a way around for changing the color of the blank of the input field component in MD Bootstrap. Like at the moment, it looks like this (without focus):

Input Field Componentme without focus

When I click on this input field, it looks like this (with focus, the color of the input field blank changes to green):

Input Field Component with focus

The code for the this component is as follows:

<div class="input-group input-group-lg">
  <div class="input-group-prepend">
    <span class="input-group-text" id="inputGroup-sizing-lg">Name</span>
  </div>
  <input type="text" class="form-control" aria-label="Large" aria-describedby="inputGroup-sizing-sm">
</div>

I was wondering if there's a way around for changing the color of the input field blank to black instead of green when we click on it. Thanks!

keikai :

Set backgroundImage style with <input /> would work

Try it in-text:

const style = {
  backgroundImage: `linear-gradient(0deg, black 2px, rgba(0, 150, 136, 0) 0),
    linear-gradient(0deg, rgba(0, 0, 0, 0.26) 1px, transparent 0)`
};
const App = () => {
  return (
    <div className="App">
      <div class="input-group input-group-lg">
        <div class="input-group-prepend">
          <span class="input-group-text" id="inputGroup-sizing-lg">
            Large
          </span>
        </div>
        <input
          type="text"
          class="form-control"
          aria-label="Large"
          style={style}
          aria-describedby="inputGroup-sizing-sm"
        />
      </div>
    </div>
  );
};
ReactDOM.render(<App />, document.getElementById("root"));
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.12.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.12.0/umd/react-dom.production.min.js"></script>
<link
  rel="stylesheet"
  href="https://unpkg.com/[email protected]/dist/css/bootstrap-material-design.min.css"
  integrity="sha384-wXznGJNEXNG1NFsbm0ugrLFMQPWswR3lds2VeinahP8N0zJw9VWSopbjv2x7WCvX"
  crossorigin="anonymous"
/>


The step to achieve it:

If you check the style in the browser,

You would find that color with animation, copy it and change that color, and that's it.

enter image description here

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=376900&siteId=1