Input group
Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs.
Example
<div class="input-group"> <span class="input-group-text" id="basic-addon1">@</span> <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1"></div>
Sizing
Add .input-group-{sm,lg}
classes to the .input-group
for small, large size.
<div class="input-group"> <span class="input-group-text" id="inputGroup-sizing-default">Default</span> <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"></div>
Checkboxes and radios
Place any checkbox or radio option within an input group’s addon instead of text. We recommend adding .mt-0
to the .form-check-input
when there’s no visible text next to the input.
<div class="input-group"> <div class="input-group-text"> <input class="form-check-input mt-0" type="checkbox" value="" aria-label="Checkbox for following text input"> </div> <input type="text" class="form-control" aria-label="Text input with checkbox"></div>
Multiple inputs
While multiple input
s are supported visually, validation styles are only available for input groups with a single input
.
<div class="input-group"> <span class="input-group-text">First and last name</span> <input type="text" aria-label="First name" class="form-control"> <input type="text" aria-label="Last name" class="form-control"></div>
Multiple addons
Multiple add-ons are supported and can be mixed with checkbox and radio input versions.
<div class="input-group"> <span class="input-group-text">$</span> <span class="input-group-text">0.00</span> <input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)"></div>
Button addons and dropdowns
<div class="input-group"> <button class="btn btn-outline-primary" type="button" id="button-addon1">Button</button> <input type="text" class="form-control" placeholder="" aria-label="Example text with button addon" aria-describedby="button-addon1"></div>
<div class="input-group"> <button class="btn btn-outline-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li><a class="dropdown-item" href="#">Something else here</a></li> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="#">Separated link</a></li> </ul> <input type="text" class="form-control" aria-label="Text input with dropdown button"></div>
Segmented buttons
<div class="input-group"> <button type="button" class="btn btn-outline-primary">Action</button> <button type="button" class="btn btn-outline-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"> <span class="visually-hidden">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li><a class="dropdown-item" href="#">Something else here</a></li> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="#">Separated link</a></li> </ul> <input type="text" class="form-control" aria-label="Text input with segmented dropdown button"></div>
Custom forms
Input groups include support for custom selects and custom file inputs. Browser default versions of these are not supported.
<div class="input-group"> <label class="input-group-text" for="inputGroupSelect01">Options</label> <select class="form-select" id="inputGroupSelect01"> <option selected>Choose...</option> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select></div>
<div class="input-group"> <button class="btn btn-outline-primary" type="button">Button</button> <select class="form-select" id="inputGroupSelect03" aria-label="Example select with button addon"> <option selected>Choose...</option> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select></div>
Custom file input
Input groups include support for custom selects and custom file inputs. Browser default versions of these are not supported.
<div class="input-group"> <label class="input-group-text" for="inputGroupFile01">Upload</label> <input type="file" class="form-control" id="inputGroupFile01"></div>