Basic Buttons
Default
Use the .btn
.btn-{color}
classes.
Outline
In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the .btn-outline-*
ones to remove all background images and colors on any button.
Rounded
Use a class .rounded-pill
with .btn
class to create round button.
Button Sizes
Fancy larger or smaller buttons? Add .btn-lg
or .btn-sm
for additional sizes.
Button Group
Wrap a series of buttons with .btn
in .btn-group
.
Sizing
Instead of applying button sizing classes to every button in a group, just add .btn-group-*
to each .btn-group
, including each one when nesting multiple groups.
<div class="btn-group" role="group" aria-label="Basic example"> <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 States
Make buttons look inactive by adding the disabled
boolean attribute to any <button>
element. Disabled buttons have pointer-events: none
applied to, preventing hover and active states from triggering.
Button Group Nesting
Place a .btn-group
within another .btn-group
when you want dropdown menus mixed with a series of buttons.
<div class="btn-group" role="group" aria-label="Button group with nested dropdown"> <button type="button" class="btn btn-primary">1</button> <button type="button" class="btn btn-primary">2</button> <div class="btn-group" role="group"> <button id="btnGroupDrop1" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> Dropdown </button> <ul class="dropdown-menu" aria-labelledby="btnGroupDrop1"> <li><a class="dropdown-item" href="#">Dropdown link</a></li> <li><a class="dropdown-item" href="#">Dropdown link</a></li> </ul> </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"> ... </div>