Buttons
Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
Sizes
Fancy larger or smaller buttons? Add
.btn-lg
or
.btn-sm
for additional sizes.
Here we create a responsive variation, starting with vertically stacked buttons until the
md
breakpoint, where
.d-md-block
replaces the
.d-grid
class, thus nullifying the
gap-2
utility. Resize your browser to see them change.
You can adjust the width of your block buttons with grid column width classes. For example, for a half-width “block button”, use
.col-6
. Center it horizontally with
.mx-auto
, too.
Additional utilities can be used to adjust the alignment of buttons when horizontal. Here we’ve taken our previous responsive example and added some flex utilities and a margin utility on the button to right align the buttons when they’re no longer stacked.
Active state
Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active.
There’s no need to add a class to
<button>
s as they use a pseudo-class
. However, you can still force the same active appearance with
.active
(and include the
aria-pressed="true"
attribute) should you need to replicate the state programmatically.
Disabled state
Make buttons look inactive by adding the
disabled
boolean attribute to any
<button>
element.
Toggle states
Add
data-bs-toggle="button"
to toggle a button’s
active
state. If you’re pre-toggling a button, you must manually add the
.active
class
and
aria-pressed="true"
to the
<button>
.