Module: GOVUKDesignSystemFormBuilder::Traits::Input

Included in:
Elements::Inputs::Email, Elements::Inputs::Number, Elements::Inputs::Phone, Elements::Inputs::Text, Elements::Inputs::URL
Defined in:
lib/govuk_design_system_formbuilder/traits/input.rb

Instance Method Summary collapse

Instance Method Details

#htmlObject



18
19
20
21
22
# File 'lib/govuk_design_system_formbuilder/traits/input.rb', line 18

def html
  Containers::FormGroup.new(*bound, **@form_group).html do
    safe_join([label_element, supplemental_content, hint_element, error_element, content])
  end
end

#initialize(builder, object_name, attribute_name, hint:, label:, caption:, prefix_text:, suffix_text:, width:, extra_letter_spacing:, form_group:, **kwargs, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/govuk_design_system_formbuilder/traits/input.rb', line 4

def initialize(builder, object_name, attribute_name, hint:, label:, caption:, prefix_text:, suffix_text:, width:, extra_letter_spacing:, form_group:, **kwargs, &block)
  super(builder, object_name, attribute_name, &block)

  @width                = width
  @label                = label
  @caption              = caption
  @hint                 = hint
  @prefix_text          = prefix_text
  @suffix_text          = suffix_text
  @html_attributes      = kwargs
  @form_group           = form_group
  @extra_letter_spacing = extra_letter_spacing
end