New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: official support for form-floating and input-group #34513
Comments
Doing a little more testing, in some cases the form-floating input would break with a button funny as seen in the codepen above on small width screens (mobile). |
Made a PR #34527 The above codepen (only important parts) with the PR: I ended up using explicit .form-control and .form-select selectors, because otherwise the styling ends up applying to the
Over something like
Obviously, if this is acceptable, will still want to add some examples to the docs. |
I compared it to bootstraps default floating labels and I see no difference. |
I can see where it looks a little off center, but I looked at it for so long I'm used to it. I get your point that the @ sign doesn't really make sense as a prefix to the label "Username", but there are other examples that make more sense. For example, using input-group buttons and dropdowns. I also wanted it for alignment purposes with other .form-floating elements. In addition, googling around, there are various options which become possible with this fix. For example, I see this, which uses a different layout you could achieve by changing some border styles: I updated this pen real quick for a rough example (last input): In summary:
|
@mdo @ffoodd If you don't want to support it and just want to kill the PR, that's fine, but some response would help me at least know if this has any chance of getting merged so I don't keep pestering if it isn't in alignment with the project direction. Thank you sincerely for your time and effort in maintaining such an awesome repo. |
So sorry! Let me try to merge it today, I've seen enough issue requests to justify it :). |
Thank you all very much! |
There are quite a few issues in regards to using form-floating with input-group, and the proper markup for such:
#34275
#34198
#33871
#33741
#33721
#33341
Bootstrap's reply is "not supported at this time". Makes sense. I really wanted to have this work, so went through various ways to make this happen. I think it can be supported fairly easily with just a few rule adjustments. So I'm leaving my findings here in hopes of discussion to support this in the main branch.
From my findings, there are 4 problems with using input-group with form-floating:
What is the proper markup? Some people are combining input-group with form-floating in the same element, which causes problems when you have prefixes to the input-group such that the form-control isn't the first element in the group. The benefit to this approach is that it (sort of) fixes some of the border-radius issues. However, IMO the floating issues would be very difficult to solve cleanly. So, form-floating used on a child element of input-group works best here.
z-index focus/hover issues. Solved by CSS rule.
border-radius issues. Solved by CSS rule.
form-control flex-grow issues. Solved by CSS rule.
My findings are most easily seen in the codepen provided below. I may be overlooking some cases, obviously. But, it seems to work for my purposes. Do you have any feedback?
Associated codepen:
https://codepen.io/nefiga/pen/VwbpdVw
Anyway, feel free to close this if these types of requests are driving you nuts, just figured I'd at least provide feedback on what I assembled over a few hours.
The text was updated successfully, but these errors were encountered: