Overview
Wrap a series of buttons with .btn
in .btn-group
.
Example
Code Example
<div class="btn-group" role="group" aria-label="Basic example"> <button type="button" class="btn btn-nmw btn-primary">Left</button> <button type="button" class="btn btn-nmw btn-primary">Middle</button> <button type="button" class="btn btn-nmw btn-primary">Right</button> </div>
Mixed styles
Code Example
<div class="btn-group" role="group" aria-label="Basic mixed styles example"> <button type="button" class="btn btn-nmw btn-danger">Left</button> <button type="button" class="btn btn-nmw btn-warning">Middle</button> <button type="button" class="btn btn-nmw btn-success">Right</button> </div>
Outlined styles
Code Example
<div class="btn-group" role="group" aria-label="Basic outlined example"> <button type="button" class="btn btn-nmw btn-outline-primary">Left</button> <button type="button" class="btn btn-nmw btn-outline-primary">Middle</button> <button type="button" class="btn btn-nmw btn-outline-primary">Right</button> </div>
Dim buttons
Use the .btn-dim
class with .btn
class
Code Example
<div class="btn-group" role="group" aria-label="Basic dim example"> <button type="button" class="btn btn-nmw btn-dim btn-primary">Left</button> <button type="button" class="btn btn-nmw btn-dim btn-primary">Middle</button> <button type="button" class="btn btn-nmw btn-dim btn-primary">Right</button> </div>
Checkbox button groups
Combine button-like checkbox and radio
Code Example
<div class="btn-group" role="group"> <input type="checkbox" class="btn-check" id="btncheck1" autocomplete="off"> <label class="btn btn-nmw btn-outline-primary" for="btncheck1">Checkbox 1</label> <input type="checkbox" class="btn-check" id="btncheck2" autocomplete="off"> <label class="btn btn-nmw btn-outline-primary" for="btncheck2">Checkbox 2</label> <input type="checkbox" class="btn-check" id="btncheck3" autocomplete="off"> <label class="btn btn-nmw btn-outline-primary" for="btncheck3">Checkbox 3</label> </div>
Radio button groups
Code Example
<div class="btn-group" role="group"> <input type="radio" class="btn-check" name="btnradio" id="btnradio1" autocomplete="off" checked> <label class="btn btn-nmw btn-outline-primary" for="btnradio1">Radio 1</label> <input type="radio" class="btn-check" name="btnradio" id="btnradio2" autocomplete="off"> <label class="btn btn-nmw btn-outline-primary" for="btnradio2">Radio 2</label> <input type="radio" class="btn-check" name="btnradio" id="btnradio3" autocomplete="off"> <label class="btn btn-nmw btn-outline-primary" for="btnradio3">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.
Code Example
<div class="btn-toolbar" role="toolbar"> <div class="btn-group me-2" role="group"> <button type="button" class="btn btn-nmw btn-primary">1</button> <button type="button" class="btn btn-nmw btn-primary">2</button> <button type="button" class="btn btn-nmw btn-primary">3</button> <button type="button" class="btn btn-nmw btn-primary">4</button> </div> <div class="btn-group me-2" role="group"> <button type="button" class="btn btn-nmw btn-secondary">5</button> <button type="button" class="btn btn-nmw btn-secondary">6</button> <button type="button" class="btn btn-nmw btn-secondary">7</button> </div> <div class="btn-group" role="group"> <button type="button" class="btn btn-nmw btn-info">8</button> </div> </div>
Feel free to mix input groups with button groups in your toolbars. Similar to the example above, you’ll likely need some utilities though to space things properly.
Code Example
<div class="btn-toolbar mb-3" role="toolbar"> <div class="btn-group me-2" role="group"> <button type="button" class="btn btn-nmw btn-outline-primary">1</button> <button type="button" class="btn btn-nmw btn-outline-primary">2</button> <button type="button" class="btn btn-nmw btn-outline-primary">3</button> <button type="button" class="btn btn-nmw btn-outline-primary">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"> <div class="btn-group" role="group"> <button type="button" class="btn btn-nmw btn-outline-primary">1</button> <button type="button" class="btn btn-nmw btn-outline-primary">2</button> <button type="button" class="btn btn-nmw btn-outline-primary">3</button> <button type="button" class="btn btn-nmw btn-outline-primary">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.
Code Example
<div class="btn-group btn-group-lg" role="group">...</div> <div class="btn-group" role="group">...</div> <div class="btn-group btn-group-sm" role="group">...</div>
Nesting
Place a .btn-group
within another .btn-group
when you want dropdown menus mixed with a series of buttons.
Code Example
<div class="btn-group" role="group"> <button type="button" class="btn btn-nmw btn-primary">1</button> <button type="button" class="btn btn-nmw btn-primary">2</button> <div class="btn-group" role="group"> <button id="btnGroupDrop1" type="button" class="btn btn-nmw btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <span>Dropdown</span> <em class="ni ni-chevron-down icon"></em> </button> <div class="dropdown-menu dropdown-menu-sm"> <ul class="link-list-opt"> <li><a href="#">Dropdown link</a></li> <li><a href="#">Dropdown link</a></li> </ul> </div> </div> </div>
Vertical variation
Make a set of buttons appear vertically stacked rather than horizontally. Split button dropdowns are not supported here.
Code Example
<div class="btn-group-vertical" role="group"> <button type="button" class="btn btn-nmw btn-dark">Button</button> <button type="button" class="btn btn-nmw btn-dark">Button</button> <button type="button" class="btn btn-nmw btn-dark">Button</button> <button type="button" class="btn btn-nmw btn-dark">Button</button> <button type="button" class="btn btn-nmw btn-dark">Button</button> <button type="button" class="btn btn-nmw btn-dark">Button</button> </div>
Vertical variation with dropdown
Code Example
<div class="btn-group-vertical" role="group"> <button type="button" class="btn btn-nmw btn-primary">Button</button> <button type="button" class="btn btn-nmw btn-primary">Button</button> <div class="btn-group" role="group"> <button id="btnGroupVerticalDrop1" type="button" class="btn btn-nmw btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <span>Dropdown</span> <em class="ni ni-chevron-down icon"></em> </button> <div class="dropdown-menu dropdown-menu-sm"> <ul class="link-list-opt"> <li><a href="#">Dropdown link</a></li> <li><a href="#">Dropdown link</a></li> </ul> </div> </div> <button type="button" class="btn btn-nmw btn-primary">Button</button> <button type="button" class="btn btn-nmw btn-primary">Button</button> <div class="btn-group" role="group"> <button id="btnGroupVerticalDrop2" type="button" class="btn btn-nmw btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <span>Dropdown</span> <em class="ni ni-chevron-down icon"></em> </button> <div class="dropdown-menu dropdown-menu-sm"> <ul class="link-list-opt"> <li><a href="#">Dropdown link</a></li> <li><a href="#">Dropdown link</a></li> </ul> </div> </div> <div class="btn-group" role="group"> <button id="btnGroupVerticalDrop3" type="button" class="btn btn-nmw btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <span>Dropdown</span> <em class="ni ni-chevron-down icon"></em> </button> <div class="dropdown-menu dropdown-menu-sm"> <ul class="link-list-opt"> <li><a href="#">Dropdown link</a></li> <li><a href="#">Dropdown link</a></li> </ul> </div> </div> <div class="btn-group" role="group"> <button id="btnGroupVerticalDrop4" type="button" class="btn btn-nmw btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> <span>Dropdown</span> <em class="ni ni-chevron-down icon"></em> </button> <div class="dropdown-menu dropdown-menu-sm"> <ul class="link-list-opt"> <li><a href="#">Dropdown link</a></li> <li><a href="#">Dropdown link</a></li> </ul> </div> </div> </div>
Vertical variation with radio
Code Example
<div class="btn-group-vertical" role="group"> <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio1" autocomplete="off" checked> <label class="btn btn-nmw btn-outline-danger" for="vbtn-radio1">Radio 1</label> <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio2" autocomplete="off"> <label class="btn btn-nmw btn-outline-danger" for="vbtn-radio2">Radio 2</label> <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio3" autocomplete="off"> <label class="btn btn-nmw btn-outline-danger" for="vbtn-radio3">Radio 3</label> </div>