Button Group
Basic Button Group
A simple button group can be created by adding the .btn-group
class around several buttons. This keeps the buttons aligned together in a group.
Active Link
Use the .active
class to highlight a button link that is currently active. It visually indicates which link/button the user is interacting with.
Mixed Styles
You can create button groups with different button styles by mixing classes like .btn-danger
, .btn-warning
, and .btn-success
. This allows you to create button groups with different colors.
Outlined styles
Use the .btn-outline
class along with other button classes (like .btn-outline-primary
) to create buttons with borders but no solid background color.
Checkbox button groups
Checkbox-style buttons can be created by using .btn-check
for the input and .btn
for the label. These buttons toggle between checked and unchecked states.
Radio button groups
Radio-style buttons are created in a similar way to checkboxes, but the radio buttons allow only one selection at a time. Use the .btn-check
class for the radio inputs and .btn
for the labels.
Button toolbar
A button toolbar allows you to group multiple button groups together, giving you more flexibility in arranging buttons on your page. Use the .btn-toolbar
class to organize button groups.
Button Nesting
You can nest dropdowns inside button groups. This allows you to add more interactive components to your buttons, such as a dropdown menu.
Button Sizing
You can adjust the size of your buttons using classes like .btn-group-lg
for large buttons, .btn-group
for default size, and .btn-group-sm
for small buttons.
Vertical variation
A vertical button group stacks buttons on top of each other. Use the .btn-group-vertical
class to create this layout.