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.
Creating a button group is certainly really simple-- everything you really need is simply an element having the class
.btn-group
.btn-group-vertical
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
.btn-group-lg
.btn-group
.btn-group-xs
.btn-toolbar
Cover a variety of buttons by using
.btn
.btn-group
<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>
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.
<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.
<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>
As opposed to using button sizing classes to each button within a group, simply put in
.btn-group-*
.btn-group
<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>
Install a
.btn-group
.btn-group
<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>
Develop a package of buttons appear like vertically loaded instead of horizontally. Split button dropdowns are not really sustained here.
<div class="btn-group-vertical">
...
</div>
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 get a dropdown button within a
.btn-group
<button>
.dropdown-toggle
data-toggle="dropdown"
type="button"
<button>
<div>
.dropdown-menu
.dropdown-item
.dropdown-toggle
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.