I encountered the same needs.
Here's my solution:
The form :
<div class="col-12">
<div class="input-group mb-3">
<span class="input-group-text">Label :</span>
<div class="form-floating">
@Html.EditorFor(model => model.FieldA, new { htmlAttributes = new { @class = "form-control", placeholder = "Field A" } })
@Html.LabelFor(model => model.FieldA)
</div>
<div class="form-floating">
@Html.EditorFor(model => model.FieldB, new { htmlAttributes = new { @class = "form-control", placeholder = "Field B" } })
@Html.LabelFor(model => model.FieldB)
</div>
</div>
</div>
Note : i'm using ASP.NET, replace Editor and Label -For calls with your corresponding code :
<input type="text" class="form-control" name="code1" placeholder="Code 1">
<label for="code1">Code 1</label>
<span class="input-group-text"><i class="fas fa-times"></i></span>
Find Bootstrap original way (V5.1) of handling rounded border. Here are the original code lines :
.input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu),
.input-group:not(.has-validation) > .dropdown-toggle:nth-last-child(n+3) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group.has-validation > :nth-last-child(n+3):not(.dropdown-toggle):not(.dropdown-menu),
.input-group.has-validation > .dropdown-toggle:nth-last-child(n+4) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
margin-left: -1px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.input-group > .form-control,
.input-group > .form-select {
position: relative;
flex: 1 1 auto;
width: 1%;
min-width: 0;
}
And here's my custom css based on what I know of css selectors (I'm actually a backend dev) :
.input-group:not(.has-validation) .form-floating:not(:last-child) > :not(.dropdown-toggle):not(.dropdown-menu),
.input-group:not(.has-validation) .form-floating > .dropdown-toggle:nth-last-child(n+3) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group.has-validation .form-floating:nth-last-child(n+3) > :not(.dropdown-toggle):not(.dropdown-menu),
.input-group.has-validation .form-floating > .dropdown-toggle:nth-last-child(n+4) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group .form-floating:not(:first-child) > :not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
/*margin-left: -1px;*/
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
/* for form to be responsive */
.input-group > .form-floating {
position: relative;
flex: 1 1 auto;
width: 1%;
min-width: 0;
}
I guess the selectors could be greatly improved, as some cases could no more occur, feel free to submit improvements !