Input groups extend form controls by prepending or appending text labels, currency symbols, icons, action buttons, or dropdown menus on either side of an input field. In Bootstrap 5, input groups seamlessly join borders and manage border-radius rounding automatically.
.input-group-text)Wrap your input and addon elements inside a container with the .input-group class. Use .input-group-text to style static labels:
<!-- Prepend @ for Username -->
<div class="input-group mb-3">
<span class="input-group-text" id="addon-username">@</span>
<input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="addon-username">
</div>
<!-- Prepend Currency and Append .00 -->
<div class="input-group mb-3">
<span class="input-group-text">₹</span>
<input type="text" class="form-control" placeholder="Course Fee Amount" aria-label="Amount in Rupees">
<span class="input-group-text">.00</span>
</div>
Combine inputs with action buttons to create modern search bars and newsletter subscription boxes:
<!-- Search Bar with Button -->
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Search tutorials..." aria-label="Search tutorials">
<button class="btn btn-primary" type="button" id="button-search">
<i class="fa fa-search"></i> Search
</button>
</div>
Attach dropdown menus to inputs for multi-category filtering:
<div class="input-group mb-3">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Category</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">HTML / CSS</a></li>
<li><a class="dropdown-item" href="#">Bootstrap 5</a></li>
<li><a class="dropdown-item" href="#">JavaScript</a></li>
</ul>
<input type="text" class="form-control" placeholder="Type query here..." aria-label="Text input with dropdown">
</div>
Strengthen your responsive web design mastery by studying these connected classes:
Review input types, textareas, file inputs, and size modifiers.
Attach search buttons and action toggles directly to input fields.
Create currency or category pickers embedded inside text inputs.
Properly place invalid-feedback messages when inputs are grouped.
.input-group-lg or .input-group-sm to the parent .input-group container. All inputs, text addons, and buttons inside will scale automatically.
<input class='form-check-input mt-0' type='checkbox'> inside a <span class='input-group-text'>.
Advance your practical frontend engineering skills with the next topic in our synchronized curriculum.
Continue to Class 16: Floating Labels → Previous: ← Class 14: Select Menus & Range | Full Syllabus