Closed
Description
It is so natural to comment out HTML attributes that it's easy to think that Twig supports this. So easy that even the Symfony UX documentation has an example.
// ...
<div class="toggle-password-container"> // Add "toggle-password-container" or a class that applies position: relative to this container.
<label for="password">Password</label>
<input
id="password"
name="password"
type="password"
{{ stimulus_controller('symfony/ux-toggle-password/toggle-password', {
{# visibleLabel: 'Show password', // If you want to modify this label. #}
{# visibleIcon: 'Some svg icon', // If you want to modify this icon. #}
{# hiddenLabel: 'Hide password', // If you want to modify this label. #}
{# hiddenIcon: 'Some svg icon', // If you want to modify this icon. #}
buttonClasses: ['toggle-password-button'], // Add as many classes as you wish. "toggle-password-button" is needed to activate the default CSS.
}) }}
>
</div>
// ...
https://symfony.com/bundles/ux-toggle-password/current/index.html#usage-without-symfony-forms
I started to make a PR to fix the docs, but it's not easy to decide where to move it. It'd be awesome if twig allowed this, as I frequently use it for in-line comments as well as disabling attri 5772 butes.
Metadata
Metadata
Assignees
Labels
No labels