Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button group not wrapping when too long

I have a very long button group : https://jsfiddle.net/cyu4bvak/

<div class="btn-group" data-toggle="buttons">
    <label  class="btn btn-primary active">
        <input type="checkbox" />ABCDEFGHIJKLMNOPQRSTUVWXYZ
    </label>
    <label  class="btn btn-primary active">
        <input type="checkbox" />ABCDEFGHIJKLMNOPQRSTUVWXYZ
    </label>
    <label  class="btn btn-primary active">
        <input type="checkbox" />ABCDEFGHIJKLMNOPQRSTUVWXYZ
    </label>
    ...
</div>

Whatever the size of the viewport it is always taking one long line causing scrolling.

Is it possible to make it wrap so that on smaller viewports it will wrap on more lines without causing scrolling?

If no which alternative(s) do I have to obtain the expected behavior?

like image 938
Pragmateek Avatar asked Dec 07 '22 19:12

Pragmateek


2 Answers

Add flex-wrap: wrap; to the flex parent (.btn-group) if you want the flex children to wrap.

like image 131
Michael Coker Avatar answered Dec 10 '22 11:12

Michael Coker


For React-Bootstrap users:

<ButtonGroup style={{ flexWrap: "wrap" }}>
...
</ButtonGroup>
like image 22
user-124812948 Avatar answered Dec 10 '22 11:12

user-124812948