Class: GOVUKDesignSystemFormBuilder::Elements::TextArea

Inherits:
Base
  • Object
show all
Includes:
Traits::Error, Traits::HTMLAttributes, Traits::HTMLClasses, Traits::Hint, Traits::Label, Traits::Supplemental
Defined in:
lib/govuk_design_system_formbuilder/elements/text_area.rb

Instance Method Summary collapse

Methods included from Traits::HTMLClasses

#build_classes

Methods included from Traits::HTMLAttributes

#attributes

Methods included from Traits::Supplemental

#supplemental_id

Methods included from Traits::Hint

#hint_id

Methods included from Traits::Error

#error_id

Methods inherited from Base

#field_id, #to_s

Constructor Details

#initialize(builder, object_name, attribute_name, hint:, label:, caption:, rows:, max_words:, max_chars:, threshold:, form_group:, **kwargs, &block) ⇒ TextArea

Returns a new instance of TextArea.


13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/govuk_design_system_formbuilder/elements/text_area.rb', line 13

def initialize(builder, object_name, attribute_name, hint:, label:, caption:, rows:, max_words:, max_chars:, threshold:, form_group:, **kwargs, &block)
  super(builder, object_name, attribute_name, &block)

  @label           = label
  @caption         = caption
  @hint            = hint
  @max_words       = max_words
  @max_chars       = max_chars
  @threshold       = threshold
  @rows            = rows
  @form_group      = form_group
  @html_attributes = kwargs
end

Instance Method Details

#htmlObject


27
28
29
30
31
32
33
# File 'lib/govuk_design_system_formbuilder/elements/text_area.rb', line 27

def html
  Containers::CharacterCount.new(@builder, **character_count_options).html do
    Containers::FormGroup.new(*bound, **@form_group).html do
      safe_join([label_element, supplemental_content, hint_element, error_element, text_area, limit_description])
    end
  end
end