Bootstrap button group allows to group a series of buttons and power them with JavaScript.
Available in Other JavaScript Frameworks
CoreUI Bootstrap 6 Button Group is also available for Angular, React, and Vue. Explore framework-specific implementations below:
Examples
Wrap a series of buttons in .btn-group.
<div class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="btn-solid theme-primary">Left</button>
<button type="button" class="btn-solid theme-primary">Middle</button>
<button type="button" class="btn-solid theme-primary">Right</button>
</div>Button groups require an appropriate role attribute and explicit label to ensure assistive technologies like screen readers identify buttons as grouped and announce them. Use role="group" for button groups or role="toolbar" for button toolbars. Then use aria-label or aria-labelledby to label them.
With links
These classes can also be added to groups of links, as an alternative to the .nav navigation components.
<div class="btn-group">
<a href="#" class="btn-solid theme-primary active" aria-current="page">Active link</a>
<a href="#" class="btn-solid theme-primary">Link</a>
<a href="#" class="btn-solid theme-primary">Link</a>
</div>Dividers
Add a divider between buttons by adding the .btn-group-divider class to the .btn-group. Most useful when used with buttons that have the same theme color and a solid fill.
<div class="btn-group btn-group-divider" role="group" aria-label="Divided button group">
<button type="button" class="btn-solid theme-primary">Left</button>
<button type="button" class="btn-solid theme-primary active">Active</button>
<button type="button" class="btn-solid theme-primary">Right</button>
</div>
<div class="btn-group btn-group-divider" role="group" aria-label="Divided button group">
<button type="button" class="btn-solid theme-secondary">Left</button>
<button type="button" class="btn-solid theme-secondary">Right</button>
</div>Works with vertical button groups, too.
<div class="btn-group-vertical btn-group-divider" role="group" aria-label="Divided vertical button group">
<button type="button" class="btn-solid theme-primary">Left</button>
<button type="button" class="btn-solid theme-primary active">Active</button>
<button type="button" class="btn-solid theme-primary">Right</button>
</div>
<div class="btn-group-vertical btn-group-divider" role="group" aria-label="Divided vertical button group">
<button type="button" class="btn-solid theme-secondary">Left</button>
<button type="button" class="btn-solid theme-secondary">Right</button>
</div>Theme variants
Use the .theme-{color} classes to apply a theme color to a set of buttons.
<div class="btn-group" role="group" aria-label="Secondary theme example">
<button type="button" class="btn-solid theme-secondary">Left</button>
<button type="button" class="btn-solid theme-secondary">Middle</button>
<button type="button" class="btn-solid theme-secondary">Right</button>
</div>You can mix and match button variants in a button group.
<div class="btn-group" role="group" aria-label="Basic mixed styles example">
<button type="button" class="btn-solid theme-danger">Left</button>
<button type="button" class="btn-solid theme-warning">Middle</button>
<button type="button" class="btn-solid theme-success">Right</button>
</div>Style variants
All button styles are supported in button groups. Mix and match with the .btn-group-divider class to add dividers between some styles or just use the button borders in others.
<div class="btn-group btn-group-divider" role="group" aria-label="Solid example">
<button type="button" class="btn-solid theme-primary">Left</button>
<button type="button" class="btn-solid theme-primary">Middle</button>
<button type="button" class="btn-solid theme-primary">Right</button>
</div><div class="btn-group" role="group" aria-label="Outlined example">
<button type="button" class="btn-outline theme-primary">Left</button>
<button type="button" class="btn-outline theme-primary">Middle</button>
<button type="button" class="btn-outline theme-primary">Right</button>
</div><div class="btn-group btn-group-divider" role="group" aria-label="Subtle example">
<button type="button" class="btn-subtle theme-primary">Left</button>
<button type="button" class="btn-subtle theme-primary">Middle</button>
<button type="button" class="btn-subtle theme-primary">Right</button>
</div>Toggle buttons
Checkbox
Checkbox toggle buttons can be grouped together. Any or all of the buttons can be checked.
<div class="btn-group" role="group" aria-label="Basic checkbox toggle button group">
<label class="btn-check btn-outline theme-primary">
<input type="checkbox" autocomplete="off">
Check 1
</label>
<label class="btn-check btn-outline theme-primary">
<input type="checkbox" autocomplete="off">
Check 2
</label>
<label class="btn-check btn-outline theme-primary">
<input type="checkbox" autocomplete="off">
Check 3
</label>
</div>Radio
By design, radio toggle button groups can only have one button checked at a time.
<div class="btn-group" role="group" aria-label="Basic radio toggle button group">
<label class="btn-check btn-outline theme-primary">
<input type="radio" name="btnradio" autocomplete="off" checked>
Radio 1
</label>
<label class="btn-check btn-outline theme-primary">
<input type="radio" name="btnradio" autocomplete="off">
Radio 2
</label>
<label class="btn-check btn-outline theme-primary">
<input type="radio" name="btnradio" autocomplete="off">
Radio 3
</label>
</div>Button toolbar
Combine sets of button groups into button toolbars for more complex components. Use utility classes as needed to space out groups, buttons, and more.
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group" role="group" aria-label="First group">
<button type="button" class="btn-solid theme-primary">1</button>
<button type="button" class="btn-solid theme-primary">2</button>
<button type="button" class="btn-solid theme-primary">3</button>
<button type="button" class="btn-solid theme-primary">4</button>
</div>
<div class="btn-group" role="group" aria-label="Second group">
<button type="button" class="btn-solid theme-secondary">5</button>
<button type="button" class="btn-solid theme-secondary">6</button>
<button type="button" class="btn-solid theme-secondary">7</button>
</div>
<div class="btn-group" role="group" aria-label="Third group">
<button type="button" class="btn-solid theme-info">8</button>
</div>
</div>Feel free to mix input groups with button groups in your toolbars.
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups">
<div class="btn-group" role="group" aria-label="First group">
<button type="button" class="btn-outline theme-secondary">1</button>
<button type="button" class="btn-outline theme-secondary">2</button>
<button type="button" class="btn-outline theme-secondary">3</button>
<button type="button" class="btn-outline theme-secondary">4</button>
</div>
<div class="input-group">
<div class="input-group-text" id="btnGroupAddon">@</div>
<input type="text" class="form-control" placeholder="Input group example" aria-label="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-outline theme-secondary">1</button>
<button type="button" class="btn-outline theme-secondary">2</button>
<button type="button" class="btn-outline theme-secondary">3</button>
<button type="button" class="btn-outline theme-secondary">4</button>
</div>
<div class="input-group">
<div class="input-group-text" id="btnGroupAddon2">@</div>
<input type="text" class="form-control" placeholder="Input group example" aria-label="Input group example" aria-describedby="btnGroupAddon2">
</div>
</div>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. The sizes are .btn-group-xs, .btn-group-sm and .btn-group-lg — the same ladder the buttons themselves use.
<div class="btn-group btn-group-lg" role="group" aria-label="Large button group">
<button type="button" class="btn-outline theme-primary">Left</button>
<button type="button" class="btn-outline theme-primary">Middle</button>
<button type="button" class="btn-outline theme-primary">Right</button>
</div>
<div class="btn-group" role="group" aria-label="Default button group">
<button type="button" class="btn-outline theme-primary">Left</button>
<button type="button" class="btn-outline theme-primary">Middle</button>
<button type="button" class="btn-outline theme-primary">Right</button>
</div>
<div class="btn-group btn-group-sm" role="group" aria-label="Small button group">
<button type="button" class="btn-outline theme-primary">Left</button>
<button type="button" class="btn-outline theme-primary">Middle</button>
<button type="button" class="btn-outline theme-primary">Right</button>
</div>
<div class="btn-group btn-group-xs" role="group" aria-label="Extra small button group">
<button type="button" class="btn-outline theme-primary">Left</button>
<button type="button" class="btn-outline theme-primary">Middle</button>
<button type="button" class="btn-outline theme-primary">Right</button>
</div>Nesting
Place a .btn-group within another .btn-group when you want menus mixed with a series of buttons.
<div class="btn-group" role="group" aria-label="Button group with nested menu">
<button type="button" class="btn-solid theme-primary">1</button>
<button type="button" class="btn-solid theme-primary">2</button>
<div class="btn-group" role="group">
<button type="button" class="btn-solid theme-primary" data-coreui-toggle="menu" aria-expanded="false">
Menu
</button>
<div class="menu">
<a class="menu-item" href="#">Menu link</a>
<a class="menu-item" href="#">Menu link</a>
</div>
</div>
</div>Vertical variation
Make a set of buttons appear vertically stacked rather than horizontally. Split button menus are not supported here.
<div class="btn-group-vertical" role="group" aria-label="Vertical button group">
<button type="button" class="btn-solid theme-primary">Button</button>
<button type="button" class="btn-solid theme-primary">Button</button>
<button type="button" class="btn-solid theme-primary">Button</button>
<button type="button" class="btn-solid theme-primary">Button</button>
</div><div class="btn-group-vertical" role="group" aria-label="Vertical button group">
<div class="btn-group" role="group">
<button type="button" class="btn-solid theme-primary" data-coreui-toggle="menu" aria-expanded="false">
Menu
</button>
<div class="menu">
<a class="menu-item" href="#">Menu link</a>
<a class="menu-item" href="#">Menu link</a>
</div>
</div>
<button type="button" class="btn-solid theme-primary">Button</button>
<button type="button" class="btn-solid theme-primary">Button</button>
<div class="btn-group" role="group">
<button type="button" class="btn-solid theme-primary" data-coreui-toggle="menu" data-coreui-placement="left-start" aria-expanded="false">
Menu
</button>
<div class="menu">
<a class="menu-item" href="#">Menu link</a>
<a class="menu-item" href="#">Menu link</a>
</div>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn-solid theme-primary" data-coreui-toggle="menu" data-coreui-placement="right-start" aria-expanded="false">
Menu
</button>
<div class="menu">
<a class="menu-item" href="#">Menu link</a>
<a class="menu-item" href="#">Menu link</a>
</div>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn-solid theme-primary" data-coreui-toggle="menu" data-coreui-placement="top-start" aria-expanded="false">
Menu
</button>
<div class="menu">
<a class="menu-item" href="#">Menu link</a>
<a class="menu-item" href="#">Menu link</a>
</div>
</div>
</div><div class="btn-group-vertical" role="group" aria-label="Vertical radio toggle button group">
<label class="btn-check btn-outline theme-danger">
<input type="radio" name="vbtn-radio" autocomplete="off" checked>
Radio 1
</label>
<label class="btn-check btn-outline theme-danger">
<input type="radio" name="vbtn-radio" autocomplete="off">
Radio 2
</label>
<label class="btn-check btn-outline theme-danger">
<input type="radio" name="vbtn-radio" autocomplete="off">
Radio 3
</label>
</div>