Fuzzyma
Fuzzyma

Reputation: 8474

How to append a checkbox to a button group? (Bootstrap 3)

I am forced to use bootstrap 3. I need to append a checkbox (with text) to a button group. However, class="input-group-addon" doesnt seem to yield the expected result

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

<div class="container-fluid">
  <div class="row">
    <div class="col-xs-12">
    
      <div class="input-group-btn">
        <label class="input-group-addon">
          <input type="checkbox">
          Auto Draw
        </label>
        <button class="btn">Button1</button>
        <button class="btn">Button2</button>
        <button class="btn">Button3</button>
      </div>
    
    </div>
  </div>
</div>

Is there a different class to append something to a button group?

Upvotes: 1

Views: 859

Answers (1)

Andrew Halpern
Andrew Halpern

Reputation: 514

This appears to do something similar to what you'd expect. I wrapped the container in the "input-group" class. https://getbootstrap.com/docs/3.4/components/#input-groups-basic

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

<div class="container-fluid">
  <div class="row">
    <div class="col-xs-12">
    
      <div class="input-group">
        <label class="input-group-addon">
          <input type="checkbox">Auto Draw</label>
        <div class="input-group-btn">
          <button class="btn">Button1</button>
          <button class="btn">Button2</button>
          <button class="btn">Button3</button>
        </div>
      </div>
    
    </div>
  </div>
</div>

Upvotes: 1

Related Questions