Bootstrap Input Group Example

Ruth Jul 09, 2026

Bootstrap, the popular CSS framework, offers a wide range of pre-built components to simplify and speed up web development. One of these components is the input group, which helps combine form controls and add-ons like buttons, dropdowns, and labels in a single, elegant element. Let's explore some practical examples of Bootstrap input groups.

an email form with two different types of letters and numbers on the top right hand corner
an email form with two different types of letters and numbers on the top right hand corner

Before diving into the examples, ensure you have included the Bootstrap CSS and JavaScript files in your project. You can download them from the official Bootstrap website or use a CDN link. Once you've set up the necessary files, you can start building your input groups.

Bootstrap 5.3 (2025) Cheat Sheet
Bootstrap 5.3 (2025) Cheat Sheet

Basic Input Group Example

The most fundamental input group consists of an input field and an add-on, such as a button or an icon. Here's a simple example:

Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes
Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes

<div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text">@</span> </div> <input type="text" class="form-control" placeholder="Username"> </div>

Input Group with Buttons

A Beginner's Guide to the Latest Bootstrap 5 Utilities
A Beginner's Guide to the Latest Bootstrap 5 Utilities

Input groups can also include buttons. In this example, we'll add buttons on both sides of the input field:

<div class="input-group mb-3"> <div class="input-group-prepend"> <button class="btn btn-outline-secondary" type="button" id="button-addon1">Button 1</button> </div> <input type="text" class="form-control" placeholder="Recipient's username"> <div class="input-group-append"> <button class="btn btn-outline-secondary" type="button" id="button-addon2">Button 2</button> </div> </div>

Input Group with Dropdown

the color chart for different colors and font options in an iphone phone screen, including blue, red, yellow, green, black, white
the color chart for different colors and font options in an iphone phone screen, including blue, red, yellow, green, black, white

Input groups can also incorporate dropdown menus. Here's an example of an input group with a dropdown button:

<div class="input-group mb-3"> <div class="input-group-prepend"> <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Action</a> <a class="dropdown-item" href="#">Another action</a> <a class="dropdown-item" href="#">Something else here</a> </div> </div> <input type="text" class="form-control" placeholder="Dropdown input"> </div>

Input Group Sizing

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

Bootstrap provides several pre-defined sizes for input groups, allowing you to create responsive and visually consistent forms. Let's explore some size variations:

Default Size

Add Bootstrap Glyphicon to Input Box
Add Bootstrap Glyphicon to Input Box
Wizard
Wizard
Add remove input fields dynamically using jQuery and bootstrap
Add remove input fields dynamically using jQuery and bootstrap
Get Our Example of Bootstrap Analysis Template for Free
Get Our Example of Bootstrap Analysis Template for Free
Best Free Bootstrap Login Forms » CSS Author
Best Free Bootstrap Login Forms » CSS Author
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
19 Bootstrap Forms
19 Bootstrap Forms
Bootstrap Fieldset Legend: How To + Examples + Template | AZMIND
Bootstrap Fieldset Legend: How To + Examples + Template | AZMIND
Bootstrap Buttons Guide: Examples and Tutorials
Bootstrap Buttons Guide: Examples and Tutorials
Bootstrap 5 Classes List Cheat Sheet
Bootstrap 5 Classes List Cheat Sheet
Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes
Bootstrap 4 Cheat Sheet - The ultimate list of Bootstrap classes
Roundups | AZMIND - Part 4
Roundups | AZMIND - Part 4
Bootstrap 5 Admin Templates - Minimal
Bootstrap 5 Admin Templates - Minimal
Wired UI – The Best Free Bootstrap 4 UI Kit
Wired UI – The Best Free Bootstrap 4 UI Kit
Drag drop to group
Drag drop to group
HEX TIE | 168福彩五分钟®即将开奖!澳洲最幸运5_体彩澳洲幸运5_体彩专家分析结果
HEX TIE | 168福彩五分钟®即将开奖!澳洲最幸运5_体彩澳洲幸运5_体彩专家分析结果
25+ Best Free Bootstrap Admin Dashboard Templates — Speckyboy
25+ Best Free Bootstrap Admin Dashboard Templates — Speckyboy
Add a New Group in Linux with groupadd
Add a New Group in Linux with groupadd
a table that has different types of items on it, including the names and numbers
a table that has different types of items on it, including the names and numbers
Button groups with (split) dropdown/up · Issue #934 · vaadin/web-components
Button groups with (split) dropdown/up · Issue #934 · vaadin/web-components

The default size for input groups is 'md', which is suitable for most use cases. Here's an example of a default-sized input group:

<div class="input-group mb-3"> <div class="input-group-prepend"> <span class="input-group-text">@</span> </div> <input type="text" class="form-control" placeholder="Default input"> </div>

Large Input Group

To create a larger input group, use the 'lg' class. This size is ideal for inputs that require more space, such as those used in search bars:

<div class="input-group input-group-lg mb-3"> <div class="input-group-prepend"> <span class="input-group-text">@</span> </div> <input type="text" class="form-control" placeholder="Large input"> </div>

Small Input Group

For inputs that require less space, such as those used in compact forms, use the 'sm' class to create a smaller input group:

<div class="input-group input-group-sm mb-3"> <div class="input-group-prepend"> <span class="input-group-text">@</span> </div> <input type="text" class="form-control" placeholder="Small input"> </div>

With these examples, you now have a solid foundation for creating and customizing input groups in your Bootstrap projects. Experiment with different add-ons, sizes, and configurations to create unique and engaging user interfaces. Happy coding!