Skip to content

Commit c9dc8cf

Browse files
javiereguiluzkbond
authored andcommitted
[Doc] Mention that boolean properties require the dynamic syntax
1 parent bdd3107 commit c9dc8cf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/TwigComponent/doc/index.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,18 @@ prefix the attribute with ``:`` or use the normal ``{{ }}`` syntax:
295295
// pass object, array, or anything you imagine
296296
<twig:Alert :foo="['col' => ['foo', 'oof']]" />
297297

298+
Boolean props require using the dynamic syntax:
299+
300+
.. code-block:: html+twig
301+
302+
{# in this example, the 'false' value is passed as a string
303+
(so it's converted automatically to the true boolean value) #}
304+
<twig:Alert message="..." withCloseButton="false" />
305+
306+
{# in the following examples, the 'false' value is passed as a boolean property #}
307+
<twig:Alert message="..." :withCloseButton="false" />
308+
<twig:Alert message="..." withCloseButton="{{ false }}" />
309+
298310
Don't forget that you can mix and match props with attributes that you
299311
want to render on the root element:
300312

0 commit comments

Comments
 (0)