Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Bootstrap 5 Theme: Better support toggle buttons or document status-quo? #43629

Closed
@ThomasLandauer

Description

@ThomasLandauer

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:

All this applies to checkboxes, but for radios it's probably quite the same.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions