Topic: Change the form input control indicator color on focus
devtrix pro asked 7 years ago
Tomek Makowski staff answered 4 years ago
Hi
Just try to use input:focus {} ~ i
pseudo class in your css rules
Regards
Pasha Pshenishnyuk free answered 4 years ago
Hi! How can i change icon color when input is focused?
MDBInput name="email" label="Эл. почта" icon="envelope" type="email"
I've changed border color, and i also need to change icon color
siddagz free commented 3 years ago
Try this, in scss
.md-form label.active { color: black !important; }
.md-form .prefix.active { color: blue !important; }
Hi, u said you changed the border color, can help me on that?
Marcin Luczak staff commented 3 years ago
Hi @siddagz,
Depending on which version of the MDB you want to use you can try these styles for changing the border of the input:For MDB4 (jquery version):
`.md-form input:focus { border-bottom: 1px solid red !important; box-shadow: 0 1px 0 0 #f76363 !important; // you can here use any reddish color or just use 'none' to disable any box-shadow}
.md-form label.active { color: red !important;}`
For MDB5 (standard non jquery version):
`.form-control:focus ~ .form-label{ color: red !important;}
.form-control:focus ~ .form-notch div { border-color: red !important;}`
Keep coding, Marcin
David Schartner free answered 4 years ago
Hi,
how can I change the icon color as well?
<div class="md-form form-sm"> <i class="fas fa-user prefix"></i>
<input type="text" id="form3" class="form-control form-control-sm">
<label for="form3">Your name</label>
</div>
Thanks for help.
David
Krzysztof Wilk staff commented 4 years ago
Hi!
About changing icon color you can read here: https://mdbootstrap.com/docs/react/content/icons-usage/
All you have to do is add class with your color, for example .amber-text
or .orange-text
:)
paolo.guerra free answered 7 years ago
devtrix pro answered 7 years ago
Marta Wierzbicka staff answered 7 years ago
input[type=text]:focus:not([readonly]) + label {
color: green;
}
input[type=text]:focus:not([readonly]) {
border-bottom: 1px solid green;
box-shadow: 0 1px 0 0 green;
}
Of course, you can change green
to any hex color you wish.
Best,
Marta
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No