app/components/password_toggle_component.html.erb
<%= content_tag(:'lg-password-toggle', **tag_options) do %>
<%= render ValidatedFieldComponent.new(
form:,
name: :password,
type: :password,
label: label,
**field_options,
input_html: field_options[:input_html].to_h.merge(
id: input_id,
class: ['password-toggle__input', *field_options.dig(:input_html, :class)],
),
) %>
<input
id="<%= toggle_id %>"
type="checkbox"
class="usa-checkbox__input password-toggle__toggle"
aria-controls="<%= input_id %>"
>
<label
for="<%= toggle_id %>"
class="usa-checkbox__label password-toggle__toggle-label"
>
<%= toggle_label %>
</label>
<% end %>