Buttons
Bootstrap Buttons
Note: We are transitioning MDB4 to a legacy version and focusing on developing MDB5.
While we'll continue to support for the transition period, we encourage you to migrate to
MDB5. We're offering a huge discount on MDB5 PRO to help with your transition,
enabling you to leverage the full potential of the latest version. You can find more information here.
upgrade with discount
Examples
Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark">Dark</button>
<button type="button" class="btn btn-link">Link</button>
"Back to the top" button MDB Pro component"
A "Back to the top" button is very useful for long pages, especially on mobile devices.
Click the button below to see the live example.
Live exampleUsage: To make it work, you have to set the ID #top-section
to any element on the
top of the page.
<div class="fixed-action-btn smooth-scroll" style="bottom: 45px; right: 24px;">
<a href="#top-section" class="btn-floating btn-large red">
<i class="fas fa-arrow-up"></i>
</a>
</div>
Sizes
Fancy larger or smaller buttons? Add .btn-lg
or .btn-sm
for
additional sizes.
<button type="button" class="btn btn-default btn-lg">Large button</button>
<button type="button" class="btn btn-primary btn-lg">Large button</button>
<button type="button" class="btn btn-default btn-sm">Small button</button>
<button type="button" class="btn btn-primary btn-sm">Small button</button>
Create block level buttons—those that span the full width of a parent—by adding the class.btn-block
.
<button type="button" class="btn btn-default btn-lg btn-block">Block level button</button>
<button type="button" class="btn btn-primary btn-lg btn-block">Block level button</button>
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.
<a class="btn btn-primary btn-lg active" role="button" aria-pressed="true">Primary link</a>
<a class="btn btn-default btn-lg active" role="button" aria-pressed="true">Link</a>
Disabled state
Make buttons look inactive by adding the disabled
boolean attribute to any
<button>
element.
<button type="button" class="btn btn-primary btn-lg" disabled>Primary button</button>
<button type="button" class="btn btn-default btn-lg" disabled>Button</button>