Combine sets of button groups into button toolbars for more complex components. Use utility classes as needed to space out groups, buttons, and more.
With Input Groups
Mix input groups with button groups in your toolbars. Similar to the example above, you may need some utilities classes to space things out.
@
@
Sizing
Instead of applying button sizing classes to every button in a group, just add .btn-group-* to each .btn-group, including each one when nesting multiple groups.
Nesting
Place a .btn-group within another .btn-group when you want dropdown menus mixed with a series of buttons. You can add .btn-group-end to the toggle button to keep its border-radius from being reset.
Due to their specific implementation (and some other components), a bit of special casing is required for tooltips and popovers within button groups. You’ll have to specify the option container: 'body' to avoid unwanted side effects (such as the element growing wider and/or losing its rounded corners when the tooltip or popover is triggered).
Accessibility
Ensure correct role and provide a label
In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate role attribute needs to be provided. For button groups, this would be role="group", while toolbars should have a role="toolbar".
In addition, groups and toolbars should be given an explicit label, as most assistive technologies will otherwise not announce them, despite the presence of the correct role attribute. In the examples provided here, we use aria-label, but alternatives such as aria-labelledby can also be used.
SASS Reference
Variables
The available Customization options, or Sass variables, that can be customized for the button group component.
Name
Type
Default
Description
$enable-btn-group
boolean
true
Enable the generation of the button group component classes.
Smaller segements of the button group component classes can be disabled with the following $enable-* variables.
$enable-btn-group-horizontal
boolean
true
Enable the generation of the horizontal button group classes.
$enable-btn-group-vertical
boolean
true
Enable the generation of the vertical button group classes.
$enable-btn-group-sizing
boolean
true
Enable the generation of the button group sizing classes.
$enable-btn-toolbar
boolean
true
Enable the generation of the button toolbar classes.