'Bootstrap 5 Radio toggle buttons btn-check with btn-sm class

I'm trying to use the btn-check class along with btn-sm to get smaller buttons but it ignores the small class. Am I missing something or is there another way to make the buttons smaller?

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<div class="row g-2 mx-2 my-2">
  <div class="btn-group col-6" role="group">
    <input type="radio" class="btn-check btn-sm" name="option" id="option-1" value="yes">
    <label class="btn btn-outline-success" for="option-1">Yes</label>
    
    <input type="radio" class="btn-check btn-sm" name="option" id="option-2" value="na">
    <label class="btn btn-outline-secondary" for="option-2">I Don't Know</label>

    <input type="radio" class="btn-check btn-sm" name="option" id="option-3" value="no">
    <label class="btn btn-outline-danger" for="option-3">No</label>
  </div>
  </div>


Solution 1:[1]

Here you go...

  1. Remove the btn-sm class from <input> elements.
  2. Add the btn-sm class to the <div class="btn-group col-6" role="group"> and all three <label> elements.

See the snippet below.

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

<div class="row g-2 mx-2 my-2">
  <div class="btn-group col-6 btn-sm" role="group">
    <input type="radio" class="btn-check" name="option" id="option-1" value="yes" />
    <label class="btn btn-outline-success btn-sm" for="option-1">Yes</label>

    <input type="radio" class="btn-check" name="option" id="option-2" value="na" />
    <label class="btn btn-outline-secondary btn-sm" for="option-2">I Don't Know</label>

    <input type="radio" class="btn-check" name="option" id="option-3" value="no" />
    <label class="btn btn-outline-danger btn-sm" for="option-3">No</label>
  </div>
</div>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cervus camelopardalis