Description
Description
The form theme is almost supporting "toggle buttons" https://getbootstrap.com/docs/5.1/forms/checks-radios/#toggle-buttons - so my question is how to proceed.
Status:
By adding
['attr' => ['class' => 'btn-check'], 'label_attr' => ['class' => 'btn btn-primary']
... you're getting:
<input class="btn-check form-check-input">
<label class="btn btn-primary form-check-label">
According to the Bootstrap docs, form-check-input
shouldn't be added to the <input>
, but it's hard-coded in the form theme: https://github.com/symfony/symfony/blob/5.4/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_layout.html.twig#L212
Same for form-check-label
on the <label>
: https://github.com/symfony/symfony/blob/5.4/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_layout.html.twig#L279
So my question is:
- Is this going to stay this way? (I haven't really checked if those superfluous classes do any harm) => Then I'd just add another heading under https://symfony.com/doc/current/form/bootstrap5.html#switches and explain it
- Or should this be changed?
All this applies to checkboxes, but for radios it's probably quite the same.