Tooltips & popovers in button groups require special setting
When using tooltips or popovers on elements within a
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).
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".
One exception are groups which only contain a single control (for instance
the justified button groups with
<button> elements) or a dropdown.
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-labelled by can also be used.
Wrap a series of buttons with
Combine sets of
<div class="btn-group"> into a
for more complex components.
Instead of applying button sizing classes to every button in a group,
.btn-group-* to each
.btn-group, including when nesting multiple groups.
.btn-group within another
.btn-group when you want dropdown menus
mixed with a series of buttons.
Make a set of buttons appear vertically stacked rather than horizontally. Split button dropdowns are not supported here.
Justified button groups
Make a group of buttons stretch at equal sizes to span the entire width of its parent. Also works with button dropdowns within the button group.
To use justified button groups with
<button> elements, you must wrap each
button in a button group. Most browsers don't properly apply our CSS for
<button> elements, but since we support button dropdowns,
we can work around that.