bootstrap-ruby / bootstrap_form

Official repository of the bootstrap_form gem, a Rails form builder that makes it super easy to create beautiful-looking forms using Bootstrap 5.
MIT License
1.64k stars 352 forks source link

Overriding form tag's 'control_col' not working for f.check_box (layout: :horizontal) #722

Open budiljak opened 5 months ago

budiljak commented 5 months ago

Hi.

In the last update your added magic .offset-col-X for the check boxes in bootstrap forms with horizontal layout - which is cool. It derives an offset by the label_col setting for the form tag.

BUT in certain forms I need to override this:

f.check_box :ausgeblendet, label_col: "", control_col: "col-sm-12"

By setting label_col to nothing ("") the offset is removed - as expected. But unfortunately

control_col: "col-sm-12"

doesn't work and the class for the surrounding div stays as given in den form tag. E.g. if I define the form with control_col: "col-sm-10" this class is used for the surrounding div. No matter what option I add to the check_box .

EDIT: Maybe inline: true should do what I wan't?! But it also doesn't. There's

Cheers and thanks for the gem! Ben

PS: For anyone having the same issue, you can workaround this by setting the optionlabel_class: "text-nowrap". So the label text is written into the following empty space. ;-)