Bootstrap 4 Buttons Complete Guide for Web Developers

Buttons are one of the most useful components that are being used for various purposes like Showing, hiding submitting and much more. Bootstrap 4 includes several types of buttons which each serving its own semantic purpose, with a few extra functionality including different colors, different sizes, and different states. let’s find out more about the bootstrap 4 buttons.

Buttons in Bootstrap 4

Bootstrap 4 has different classes for the buttons that allow us to have control over its color, state, size. These buttons are normally being used with  the  <a>, <input> and <buttons> elements but can be used with any elements.

In Bootstrap the .btn class define a button. which are which are mostly used with the <button> element.

Define a button in Bootstrap as below

Bootstrap 4 Buttons: Color

Like many other components of Bootstrap 4, the buttons component has different classes for styling the button.  It basically includes the following classes for the colors.

The Result will be as the below

Bootstrap 4 buttons

 Sizes In Bootstrap 4 Buttons

Bootstrap has it too easy to bring changes to the size or styles of your components. There are 5 available size for the buttons in bootstraps which includes  large ( .btn-lg ), Medium ( .btn-md ), Small ( .btn-sm ), and the ( .btn-block ) Block level button which spans the entire width of the parent element.

Note: Bootstrap 4 has dropped the  .btn-xs extra small size button.

Bootstrap 4 button Sizes

Bootstrap 4 Button Block

States of Buttons Bootstrap 4

There are two available states in the bootstrap, the active state, and the disable state.

1- Active state:

In the Active state, the buttons will appear pressed ( darker ). you can define it with the .active class followed by aria-pressed=”true” attribute.

Bootstrap Active Buttons

Disabled state

The Disabled state is being used to look inactive. for the buttons, you don’t need to define a .dsabled class, but for the buttons with <a> elements its different, you should use the .disabled class to make it look disabled.

Bootstrap 4 Disabled buttons

 Bootstrap 4 Outline Buttons

Do you like me and many others like buttons with hefty background colors? fortunately bootstrap has brought us the .btn-outline classes to remove background images and colors of any buttons.

to to define an outline button, just add the .btn-outline classes to your buttons classes as below.

Bootstrap 4 Outline Buttons

 Using Icons With Bootstrap 4 Buttons

Using Icons With Bootstrap Buttons

Grouped Buttons

Display a series of buttons with .btn inside the .btn-group  as below:

  • Use the class .btn-group-vertical to create a vertical button group.
  • Add the class .btn-group-* to control the size of your grouped buttons.



Bootstrap 4 Grouped Buttons Display vertically Plus Large Size


That’s it about the Bootstrap 4 buttons. This article is a comprehensive guide about the Bootstrap 4 buttons. If you are interested to learn more about details of the bootstrap Components and find out more about bootstrap 4 read the bootstrap 4 documentation through their website.

You might also like

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.