Complete the code to create a basic button group container.
<div class="btn-group" role="[1]"> <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>
The role="group" attribute tells assistive technologies this container groups buttons.
Complete the code to add a vertical button group using Bootstrap classes.
<div class="btn-group-[1]" role="group" aria-label="Vertical button group"> <button type="button" class="btn btn-secondary">Top</button> <button type="button" class="btn btn-secondary">Middle</button> <button type="button" class="btn btn-secondary">Bottom</button> </div>
The class btn-group-vertical arranges buttons stacked vertically.
Fix the error in the code to correctly create a button toolbar with two button groups.
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups"> <div class="btn-group" role="[1]" aria-label="First group"> <button type="button" class="btn btn-info">1</button> <button type="button" class="btn btn-info">2</button> </div> <div class="btn-group" role="group" aria-label="Second group"> <button type="button" class="btn btn-info">3</button> <button type="button" class="btn btn-info">4</button> </div> </div>
Each button group inside a toolbar should have role="group" for accessibility.
Fill in the blank to create a button group with radio buttons that toggle selection.
<div class="btn-group" role="group" aria-label="[1]"> <input type="radio" class="btn-check" name="options" id="option1" autocomplete="off"> <label class="btn btn-outline-primary" for="option1">Option 1</label> <input type="radio" class="btn-check" name="options" id="option2" autocomplete="off"> <label class="btn btn-outline-primary" for="option2">Option 2</label> </div>
The aria-label describes them as toggle buttons. Bootstrap uses role="group" for such radio toggle button groups.
Fill both blanks to create a responsive button group with justified buttons and accessibility labels.
<div class="btn-group w-100" role="[1]" aria-label="[2]"> <button type="button" class="btn btn-success">Left</button> <button type="button" class="btn btn-success">Center</button> <button type="button" class="btn btn-success">Right</button> </div>
The btn-group w-100 creates a horizontal full-width (justified appearance) button group. The role is group for accessibility. The aria-label describes the group as justified buttons.