Bootstrap 4
Bootstrap 4 Button Groups
Bootstrap 4 button groups allow you to group buttons together, either horizontally or vertically. Group a series of buttons together on a single line with the button group, and super-power them with JavaScript.
<div class="btn-group" role="group" aria-label="Tutorials">
  <button type="button" class="btn btn-primary">PHP</button>
  <button type="button" class="btn btn-primary">JAVA</button>
  <button type="button" class="btn btn-primary">PYTHON</button>
</div>
Output :
Button Group Sizing

Instead of applying button sizes to every button in a group, use class .btn-group-lg, .btn-group, .btn-group-sm to size all buttons in the group.

<h4>Large Buttons:</h4>
<div class="btn-group btn-group-lg">
  <button type="button" class="btn btn-primary">PHP</button>
  <button type="button" class="btn btn-primary">JAVA</button>
  <button type="button" class="btn btn-primary">PYTHON</button>
</div>

<hr />

<h4>Default Buttons:</h4>
<div class="btn-group">
  <button type="button" class="btn btn-primary">HTML</button>
  <button type="button" class="btn btn-primary">CSS</button>
  <button type="button" class="btn btn-primary">CSS3</button>
</div>

<hr />

<h4>Small Buttons:</h4>
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-primary">HTML5</button>
<button type="button" class="btn btn-primary">JavaScript</button>
<button type="button" class="btn btn-primary">jQuery</button>
</div>
Output :
Nesting Buttons

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-info">1</button>
  <button type="button" class="btn btn-info">2</button>

  <div class="btn-group" role="group">
    <button id="FTl" type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Free Time Learn</button>
    <div class="dropdown-menu" aria-labelledby="FTl">
      <a class="dropdown-item" href="#">Bootstrap 3</a>
      <a class="dropdown-item" href="#">Bootstrap 4</a>
    </div>
  </div>
</div>
Output :
Button toolbar
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
  <div class="btn-group mr-2" role="group" aria-label="First 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="btn-group mr-2" role="group" aria-label="Second group">
    <button type="button" class="btn btn-primary">5</button>
    <button type="button" class="btn btn-primary">6</button>
    <button type="button" class="btn btn-primary">7</button>
  </div>
  <div class="btn-group" role="group" aria-label="Third group">
    <button type="button" class="btn btn-primary">8</button>
  </div>
</div>
Output :
Vertical Button Groups

Bootstrap 4 also supports vertical button groups, Use .btn-group with .btn-group-vertical to make the button group stack vertically.

<div class="btn-group-vertical" role="group">
	<button type="button" class="btn btn-primary">HTML5</button>
	<button type="button" class="btn btn-primary">CSS3</button>
	<button type="button" class="btn btn-primary">JavaScript</button>
	<button type="button" class="btn btn-primary">jQuery</button>
	<button type="button" class="btn btn-primary">Bootstrap</button>
</div>
Output :
Vertical Button Group With Dropdown
<div class="btn-group-vertical">
  <button type="button" class="btn btn-primary">HTML5</button>
  <button type="button" class="btn btn-primary">CSS3</button>
  <div class="btn-group">
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">Bootstrap</button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="#">Bootstrap 3</a>
      <a class="dropdown-item" href="#">Bootstrap 4</a>
    </div>
  </div>
  <button type="button" class="btn btn-primary">JavaScript</button>
  <button type="button" class="btn btn-primary">jQuery</button>
</div>
Output :