Class: CCS::Components::GovUK::Field::Input::PasswordInput
- Inherits:
-
Object
- Object
- CCS::Components::GovUK::Field::Input::PasswordInput
- Defined in:
- lib/ccs/components/govuk/field/input/password_input.rb,
lib/ccs/components/govuk/field/input/password_input/show_hide_button.rb
Overview
GOV.UK Password input
This is used for generating the password input component from the GDS - Components - Password Input
Defined Under Namespace
Classes: ShowHideButton
Instance Method Summary collapse
-
#initialize(attribute:, context:, **options) ⇒ PasswordInput
constructor
A new instance of PasswordInput.
Constructor Details
#initialize(attribute:, context:, **options) ⇒ PasswordInput
Returns a new instance of PasswordInput.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ccs/components/govuk/field/input/password_input.rb', line 28 def initialize(attribute:, context:, **) () = ShowHideButton.new(attribute: attribute, context: context, after_input: .delete(:after_input), **) [:attributes] ||= {} [:attributes][:spellcheck] = false [:attributes][:autocapitalize] = 'none' [:attributes][:autocomplete] ||= 'current-password' @text_input = TextInput.new( context: context, attribute: attribute, after_input: .render, input_wrapper: { classes: 'govuk-password-input__wrapper' }, classes: "govuk-password-input__input govuk-js-password-input-input #{.delete(:classes)}".rstrip, field_type: :password, ** ) end |