twbs / bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
https://getbootstrap.com
MIT License
170.3k stars 78.79k forks source link

Support input group with toggle buttons #37049

Open florianlacreuse opened 2 years ago

florianlacreuse commented 2 years ago

Prerequisites

Proposal

Input group supports:

Unfortunately it seems that toggle buttons are not supported.

https://stackblitz.com/edit/tybzeq

Thanks to a bit of luck it works with a toggle button at the end, but if we put it at the start the rounding is not right.

Motivation and context

It would allow to have addons with a checkbox or a radio under the hood (for a11y, at least) but with the same look as buttons.

raj-rathod commented 1 year ago

@florianlacreuse just add rounded-start class on the label

  <div class="input-group mb-3">
      <input type="checkbox" class="btn-check" id="btn-check-outlined1" autocomplete="off">
      <label class="btn btn-outline-primary rounded-start" for="btn-check-outlined1">Single toggle</label>
      <input type="text" class="form-control" placeholder="" aria-label="Example text with button addon" aria-describedby="button-addon1">
    </div>
florianlacreuse commented 1 year ago

Yes, but I see this more as a workaround.