Custom UX icons with TogglePassword #2969
-
| Hi. It is possible to use  I've this UX icon available: {{ ux_icon('bi:lock') }}And I need to apply this inside my config form builder:             ->add(
                'plainPassword',
                PasswordType::class,
                [
                    'label' => 'password',
                    'required' => false,
                    'mapped' => false,
                    'toggle' => true,
                    'visible_icon' => 'bi:lock',
                    'attr' => [
                        'data-password-generator-target' => 'password',
                        'autocomplete' => 'new-password',
                    ],
                ]
            ) | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
| Using custom UX icons with  | 
Beta Was this translation helpful? Give feedback.
-
| Finally, I decided to avoid  Thx. | 
Beta Was this translation helpful? Give feedback.
I'm on symfony/ux-toggle-password 2.30.0 with symfony/ux-icons 2.x.
In 2.x,
visible_icon/hidden_iconexpect raw SVG markup, not an icon identifier.The Stimulus controller reads the
data-*-icon-valueand injects it intoinnerHTMLas-is.So passing
'bi:lock'renders the literal textbi:lock.Workaround: render the SVG via
ux_icon()in Twig (e.g. through a small form theme override thatconverts
bi:*toux_icon('bi:*')|raw) or use the migration approach suggested in the README.