Skip to content

Commit b53b29d

Browse files
Adding label_html for asterisk
Closes #14915
1 parent 2ab9c84 commit b53b29d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

form/bootstrap4.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ Symfony Form ``RadioType`` and ``CheckboxType`` by adding some classes to the la
122122
* For a `custom checkbox`_, use ``checkbox-custom``;
123123
* For having a `switch instead of a checkbox`_, use ``switch-custom``.
124124

125+
Appending an Asterisk to Required Fields
126+
----------------------------------------
127+
128+
Since form errors are rendered *inside* the ``<label>``, you cannot use CSS ``:after``
129+
to append an asterisk to the label, cause it would be displayed after the error message.
130+
Use
131+
125132
.. code-block:: twig
126133
127134
{{ form_row(form.myRadio, {label_attr: {class: 'radio-custom'} }) }}

0 commit comments

Comments
 (0)