loading

BS4 Button Groups

Button Groups

A button group is a collection of buttons that are grouped together (on a same line) in Bootstrap 4:

==== BUTTON MUKAVA ====

To make a button group, use a <div> element with class .btn-group:

Example

				
					<div class="btn-group">
  <button type="button" class="btn btn-primary">Apple</button>
  <button type="button" class="btn btn-primary">Samsung</button>
  <button type="button" class="btn btn-primary">Sony</button>
</div>
				
			

Tip: Use class .btn-group-lg for large button groups or .btn-group-sm for tiny button groups in place of applying button sizes to each button in the group:

==== BUTTON MUKAVA ====

Example

				
					<div class="btn-group btn-group-lg">
  <button type="button" class="btn btn-primary">Apple</button>
  <button type="button" class="btn btn-primary">Samsung</button>
  <button type="button" class="btn btn-primary">Sony</button>
</div>
				
			

Vertical Button Groups

Vertical button groups are also supported by Bootstrap 4:

==== BUTTON MUKAVA ====

To construct a vertical button group, use the class .btn-group-vertical:

Example

				
					<div class="btn-group-vertical">
  <button type="button" class="btn btn-primary">Apple</button>
  <button type="button" class="btn btn-primary">Samsung</button>
  <button type="button" class="btn btn-primary">Sony</button>
</div>
				
			

Nesting Button Groups & Dropdown Menus

==== BUTTON MUKAVA ====

To create dropdown menus, nest button groups (more on dropdowns in a later chapter):

Example

				
					<div class="btn-group">
  <button type="button" class="btn btn-primary">Apple</button>
  <button type="button" class="btn btn-primary">Samsung</button>
  <div class="btn-group">
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
       Sony
    </button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="#">Tablet</a>
      <a class="dropdown-item" href="#">Smartphone</a>
    </div>
  </div>
</div>
				
			

Split Button Dropdowns

==== BUTTON MUKAVA ====

Example

				
					<div class="btn-group">
  <button type="button" class="btn btn-primary">Sony</button>
  <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-toggle="dropdown">
    <span class="caret"></span>
  </button>
  <div class="dropdown-menu">
    <a class="dropdown-item" href="#">Tablet</a>
    <a class="dropdown-item" href="#">Smartphone</a>
  </div>
</div>
				
			

Vertical Button Group w/ Dropdown

==== BUTTON MUKAVA ====

Example

				
					<div class="btn-group-vertical">
  <button type="button" class="btn btn-primary">Apple</button>
  <button type="button" class="btn btn-primary">Samsung</button>
  <div class="btn-group">
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
       Sony
    </button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="#">Tablet</a>
      <a class="dropdown-item" href="#">Smartphone</a>
    </div>
  </div>
</div>
				
			

Button Groups Side by Side

When you have numerous button groups, they will appear side by side because button groups are by default “inline”:

==== BUTTON MUKAVA ====

Example

				
					<div class="btn-group">
  <button type="button" class="btn btn-primary">Apple</button>
  <button type="button" class="btn btn-primary">Samsung</button>
  <button type="button" class="btn btn-primary">Sony</button>
</div>

<div class="btn-group">
  <button type="button" class="btn btn-primary">BMW</button>
  <button type="button" class="btn btn-primary">Mercedes</button>
  <button type="button" class="btn btn-primary">Volvo</button>
</div>
				
			
Share this Doc

BS4 Button Groups

Or copy link

Explore Topic