Button Groups & Toolbars

Bootstrap Framework 7 min min read Updated: Nov 16, 2026 Intermediate
Button Groups & Toolbars
Intermediate Topic 2 of 14

What is a Button Group?

A button group places several buttons next to each other as one connected unit. It is useful for related actions, such as Left, Center and Right alignment.

html <div class="btn-group" role="group" aria-label="Basic example"> <button type="button" class="btn btn-primary">Left</button> <button type="button" class="btn btn-primary">Middle</button> <button type="button" class="btn btn-primary">Right</button> </div>
Result

Three blue buttons joined together with rounded corners only at the outer ends.

Group Sizes

html <div class="btn-group btn-group-lg">...</div> <div class="btn-group btn-group-sm">...</div>

Vertical Button Group

html <div class="btn-group-vertical"> <button class="btn btn-dark">Top</button> <button class="btn btn-dark">Middle</button> <button class="btn btn-dark">Bottom</button> </div>

Dropdown Inside a Group

html <div class="btn-group"> <button class="btn btn-secondary">Actions</button> <button class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"> <span class="visually-hidden">Toggle Dropdown</span> </button> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Edit</a></li> <li><a class="dropdown-item" href="#">Delete</a></li> </ul> </div>

Radio and Checkbox Toggle Buttons

Hidden inputs combined with buttons create toggle buttons, which remember the user's selection.

html <div class="btn-group" role="group"> <input type="radio" class="btn-check" name="size" id="s" checked> <label class="btn btn-outline-primary" for="s">Small</label> <input type="radio" class="btn-check" name="size" id="m"> <label class="btn btn-outline-primary" for="m">Medium</label> <input type="radio" class="btn-check" name="size" id="l"> <label class="btn btn-outline-primary" for="l">Large</label> </div>

Button Toolbar

A toolbar combines several groups with space between them.

html <div class="btn-toolbar gap-2" role="toolbar"> <div class="btn-group" role="group"> <button class="btn btn-outline-secondary">1</button> <button class="btn btn-outline-secondary">2</button> </div> <div class="btn-group" role="group"> <button class="btn btn-outline-secondary">3</button> </div> </div>
Accessibility: Always add role="group" and an aria-label to a button group so that screen readers know the buttons belong together.

Conclusion

Button groups keep related actions together and tidy. Use toggle groups for choices like size or alignment.

Quick Summary: btn-group joins buttons, btn-group-vertical stacks them, btn-check turns inputs into toggle buttons, btn-toolbar combines groups.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators