Skip to content

Commit

Permalink
Documentation for Bootstrap 4 custom switches
Browse files Browse the repository at this point in the history
  • Loading branch information
Romaric Drigon committed Oct 11, 2019
1 parent 0625d9c commit fbfeec1
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit fbfeec1

Please sign in to comment.