Set floating-labels default color equal to the input placeholder color#39172
Set floating-labels default color equal to the input placeholder color#39172
Conversation
Signed-off-by: pine3ree <pine3ree@gmail.com>
…lor) to allow extra customization Signed-off-by: pine3ree <pine3ree@gmail.com>
There was a problem hiding this comment.
Thanks for this PR @pine3ree
I'm not so sure about the change of color given the fact that is first a label, so should be black. But it's also temporary a kind of placeholder too when not focused. Maybe what's strange, is not having the same color when focused and not focused.
I'll let @mdo check that from a design point of view.
However, I'd say that having a $form-floating-label-color (whatever the color chosen in the end) could be useful to override the default label color (when not focused).
| $form-floating-label-height: 1.5em !default; | ||
| $form-floating-label-opacity: .65 !default; | ||
| $form-floating-label-transform: scale(.85) translateY(-.5rem) translateX(.15rem) !default; | ||
| $form-floating-label-color: $input-placeholder-color !default; // When the label is acting as a placeholder |
There was a problem hiding this comment.
Comment can be removed. The naming of the Sass var is sufficient to understand what it does IMO.
| $form-floating-label-color: $input-placeholder-color !default; // When the label is acting as a placeholder | |
| $form-floating-label-color: $input-placeholder-color !default; |
|
Hello @julien-deramond , form what I've learned (but I could have missed something) labels (after
In all the cases listed above the label is actually positioned as an inside-input label and assigned a different color and size (more appropriate for the label role), while the default behavior ( ) is to take the place of the input placeholder.Granted, at the same time it also acts as a label, so it has to be easy to read (like a placeholder). What is kind of confusing is that the Thanks and kind regards! |
|
I believe this can be closed since #39720 was merged. |
Hello @theodorejb, |
@pine3ree That PR didn't only change the background color. It also fixed the floating label color so it no longer looks like input text when acting as a placeholder. See the preview: https://deploy-preview-39720--twbs-bootstrap.netlify.app/docs/5.3/forms/floating-labels/ |
|
@theodorejb |
Motivation & Context
Floating labels (after not focused inputs and not plaintext form-control) are used as input placeholders, so they should have the same styling (read
$input-placeholder-color) of actual input-placeholders.(edit)
Added (and used) new var:
to allow easier extra customization