Button Group
Example
<div class="btn-group"> <button type="button" class="btn btn-primary">Left</button> <button type="button" class="btn btn-primary">Middle</button> <button type="button" class="btn btn-primary">Right</button> </div>
Button toolbar
<div class="btn-toolbar"> <div class="btn-group mr-2"> <button type="button" class="btn btn-primary">1</button> <button type="button" class="btn btn-primary">2</button> <button type="button" class="btn btn-primary">3</button> <button type="button" class="btn btn-primary">4</button> </div> <div class="btn-group mr-2"> <button type="button" class="btn btn-secondary">5</button> <button type="button" class="btn btn-secondary">6</button> <button type="button" class="btn btn-secondary">7</button> </div> <div class="btn-group"> <button type="button" class="btn btn-primary">8</button> </div> </div>
<div class="btn-toolbar mb-3"> <div class="btn-group mr-2"> <button type="button" class="btn btn-primary">1</button> <button type="button" class="btn btn-primary">2</button> <button type="button" class="btn btn-primary">3</button> <button type="button" class="btn btn-primary">4</button> </div> <div class="input-group"> <div class="input-group-prepend"> <div class="input-group-text" id="btnGroupAddon">@</div> </div> <input type="text" class="form-control" placeholder="Input group example"> </div> </div> <div class="btn-toolbar justify-content-between"> <div class="btn-group"> <button type="button" class="btn btn-primary">1</button> <button type="button" class="btn btn-primary">2</button> <button type="button" class="btn btn-primary">3</button> <button type="button" class="btn btn-primary">4</button> </div> <div class="input-group"> <div class="input-group-prepend"> <div class="input-group-text" id="btnGroupAddon2">@</div> </div> <input type="text" class="form-control" placeholder="Input group example"> </div> </div>
Sizing
<div class="btn-group btn-group-sm">...</div> <div class="btn-group">...</div> <div class="btn-group btn-group-lg">...</div>
Nesting
<div class="btn-group"> <button type="button" class="btn btn-primary">1</button> <button type="button" class="btn btn-primary">2</button> <div class="btn-group"> <button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> Dropdown </button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Dropdown link</a> <a class="dropdown-item" href="#">Dropdown link</a> </div> </div> </div>
Vertical variation
Make a set of buttons appear vertically stacked rather than horizontally. Split button dropdowns are not supported here.
<div class="btn-group-vertical"> <button type="button" class="btn btn-primary">Left</button> <button type="button" class="btn btn-primary">Middle</button> <button type="button" class="btn btn-primary">Right</button> </div> <div class="btn-group-vertical"> <button type="button" class="btn btn-primary">1</button> <button type="button" class="btn btn-primary">2</button> <div class="btn-group"> <button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> Dropdown </button> <div class="dropdown-menu"> <a class="dropdown-item" href="#">Dropdown link</a> <a class="dropdown-item" href="#">Dropdown link</a> </div> </div> </div>