2

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
  • 14,085
  • 9
  • 49
  • 68
AnonSar
  • 556
  • 1
  • 7
  • 24

2 Answers2

1

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/bootstrap-material-design@4.1.1/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

keikai
  • 14,085
  • 9
  • 49
  • 68
0

You can change the border bottom:

.md-form .form-control#form1 {
  border-bottom: 1px solid #f48fb1;
}
xiedzu1503
  • 13
  • 4