JQuerySlideShowTutorial.com

Bootstrap Button groups list

Introduction

Throughout the webpages we build we frequently possess a several available solutions to present or else a couple of actions which in turn can be ultimately required worrying a specific item or a topic so it would most likely be rather useful assuming that they got an simple and convenient method designating the controls behind the visitor having one way or yet another in a compact group with common visual appeal and styling.

To care for this type of cases the latest version of the Bootstrap framework-- Bootstrap 4 has entire assistance to the so called Bootstrap Button groups panel which in turn commonly are just what the full name mention-- sets of buttons covered as a single element with all the features in looking basically the very same and so it is really convenient for the visitor to choose the right one and it's less troubling for the vision since there is certainly no free area among the some components in the group-- it looks like a one button bar having multiple opportunities.

The way to apply the Bootstrap Button groups panel:

Creating a button group is certainly really simple-- everything you really need is simply an element having the class

.btn-group
to wrap in your buttons. This generates a horizontally straightened group of buttons-- in the event that you seek a up and down stacked group apply the
.btn-group-vertical
class as a substitute.

The size of the buttons in a group may possibly be widely controlled so using assigning a single class to the entire group you can surely get both large or small buttons inside it-- just bring in

.btn-group-sm
for small or else
.btn-group-lg
class to the
.btn-group
component and all of the buttons within will get the defined size. Unlike the former edition you just can't tell the buttons in the group to expose extra small given that the
.btn-group-xs
class in no longer maintained by Bootstrap 4 framework. You have the ability to ultimately incorporate a few button groups in a toolbar simply covering them in a
.btn-toolbar
element or else nest a group in another to add a dropdown element into the child button group.

Typical example

Cover a variety of buttons by using

.btn
in

.btn-group
.

 General  instance

<div class="btn-group" role="group" aria-label="Basic example">
  <button type="button" class="btn btn-secondary">Left</button>
  <button type="button" class="btn btn-secondary">Middle</button>
  <button type="button" class="btn btn-secondary">Right</button>
</div>

Instance of the Button Toolbar

Integrate sets of Bootstrap Button groups value inside button toolbars for additional structure elements. Make use of utility classes functioning as needed to space out groups, buttons, and likewise.

 Instance of the 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-secondary">1</button>
    <button type="button" class="btn btn-secondary">2</button>
    <button type="button" class="btn btn-secondary">3</button>
    <button type="button" class="btn btn-secondary">4</button>
  </div>
  <div class="btn-group mr-2" role="group" aria-label="Second group">
    <button type="button" class="btn btn-secondary">5</button>
    <button type="button" class="btn btn-secondary">6</button>
    <button type="button" class="btn btn-secondary">7</button>
  </div>
  <div class="btn-group" role="group" aria-label="Third group">
    <button type="button" class="btn btn-secondary">8</button>
  </div>
</div>

Do not hesitate to mix up input groups with button groups within your toolbars. Similar to the example above, you'll very likely need some utilities though to place features successfully.

 Illustration of the Button Toolbar
<div class="btn-toolbar mb-3" 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-secondary">1</button>
    <button type="button" class="btn btn-secondary">2</button>
    <button type="button" class="btn btn-secondary">3</button>
    <button type="button" class="btn btn-secondary">4</button>
  </div>
  <div class="input-group">
    <span class="input-group-addon" id="btnGroupAddon">@</span>
    <input type="text" class="form-control" placeholder="Input group example" aria-describedby="btnGroupAddon">
  </div>
</div>

<div class="btn-toolbar justify-content-between" role="toolbar" aria-label="Toolbar with button groups">
  <div class="btn-group" role="group" aria-label="First group">
    <button type="button" class="btn btn-secondary">1</button>
    <button type="button" class="btn btn-secondary">2</button>
    <button type="button" class="btn btn-secondary">3</button>
    <button type="button" class="btn btn-secondary">4</button>
  </div>
  <div class="input-group">
    <span class="input-group-addon" id="btnGroupAddon2">@</span>
    <input type="text" class="form-control" placeholder="Input group example" aria-describedby="btnGroupAddon2">
  </div>
</div>

Proportions

As opposed to using button sizing classes to each button within a group, simply put in

.btn-group-*
to each and every
.btn-group
, incorporating each one when nesting numerous groups

 Proportions
<div class="btn-group btn-group-lg" role="group" aria-label="...">...</div>
<div class="btn-group" role="group" aria-label="...">...</div>
<div class="btn-group btn-group-sm" role="group" aria-label="...">...</div>

Nesting

Install a

.btn-group
inside another
.btn-group
if you want dropdown menus combined with a set of buttons. ( discover more)

Nesting
<div class="btn-group" role="group" aria-label="Button group with nested dropdown">
  <button type="button" class="btn btn-secondary">1</button>
  <button type="button" class="btn btn-secondary">2</button>

  <div class="btn-group" role="group">
    <button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      Dropdown
    </button>
    <div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
      <a class="dropdown-item" href="#">Dropdown link</a>
      <a class="dropdown-item" href="#">Dropdown link</a>
    </div>
  </div>
</div>

Vertical variation

Develop a package of buttons appear like vertically loaded instead of horizontally. Split button dropdowns are not really sustained here.

 Upright  version
<div class="btn-group-vertical">
  ...
</div>

Popovers and Tooltips

Due to the certain implementation ( plus other elements), a bit of special casing is required for tooltips and also popovers in button groups. You'll have to point out the option

container: 'body'
to stay away from undesirable lesser consequences (such as the element increasing larger and/or missing its round corners once the tooltip or else popover is caused). ( visit this link)

Other factor to keep in mind

To get a dropdown button within a

.btn-group
generate an additional component coming with the very same class within it and wrap it around a
<button>
with the
.dropdown-toggle
class,
data-toggle="dropdown"
plus
type="button"
attributes. Next with this
<button>
situate a
<div>
with the class
.dropdown-menu
and develop the hyperlinks of your dropdown within it making certain you have definitely designated the
.dropdown-item
class to each one of them. That is definitely the convenient and fast solution generating a dropdown in a button group. Optionally you have the ability to produce a split dropdown following the very same routine simply just mading one more standard button before the
.dropdown-toggle
element and getting rid of the text inside it with the result that just the tiny triangle arrow remains.

Final thoughts

Actually that is simply the approach the buttons groups get designed through probably the most famous mobile friendly framework in its current version-- Bootstrap 4. These can possibly be very helpful not only display a handful of attainable alternatives or a paths to take but also like a secondary navigation items taking place at specific spots of your web page featuring consistent visual appeal and easing up the navigating and overall user appeal.

Inspect a number of video tutorials about Bootstrap button groups:

Connected topics:

Bootstrap button group authoritative documentation

Bootstrap button group  formal  information

Bootstrap button group information

Bootstrap button group  short training

Establish buttons with Bootstrap v4

 Support buttons  by using Bootstrap v4