Skip to content

[Doc] Mention that boolean properties require the dynamic syntax #1991

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

Merged
merged 1 commit into from
Jul 18, 2024
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
12 changes: 12 additions & 0 deletions src/TwigComponent/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,18 @@ prefix the attribute with ``:`` or use the normal ``{{ }}`` syntax:
// pass object, array, or anything you imagine
<twig:Alert :foo="['col' => ['foo', 'oof']]" />

Boolean props require using the dynamic syntax:

.. code-block:: html+twig

{# in this example, the 'false' value is passed as a string
(so it's converted automatically to the true boolean value) #}
<twig:Alert message="..." withCloseButton="false" />

{# in the following examples, the 'false' value is passed as a boolean property #}
<twig:Alert message="..." :withCloseButton="false" />
<twig:Alert message="..." withCloseButton="{{ false }}" />

Don't forget that you can mix and match props with attributes that you
want to render on the root element:

Expand Down