Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form] Documented "Supporting Bootstrap 4 custom switches" #12464

Merged
merged 1 commit into from
Nov 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions form/bootstrap4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@ Custom Forms
------------

Bootstrap 4 has a feature called "`custom forms`_". You can enable that on your
Symfony Form ``RadioType`` and ``CheckboxType`` by adding a class called ``radio-custom``
and ``checkbox-custom`` respectively.
Symfony Form ``RadioType`` and ``CheckboxType`` by adding some classes over the label:

- for radio, use ``radio-custom``
- for a custom checkbox, use ``checkbox-custom``
- for having a switch instead of a checkbox, use ``switch-custom``

.. code-block:: twig
{{ form_row(form.myRadio, {label_attr: {class: 'radio-custom'} }) }}
{{ form_row(form.myCheckbox, {label_attr: {class: 'checkbox-custom'} }) }}
{{ form_row(form.myCheckbox, {label_attr: {class: 'switch-custom'} }) }}
Labels and Errors
-----------------
Expand Down