Class: Anchor::TextAreaComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/anchor/text_area_component.rb

Constant Summary collapse

INPUT_CLASSES =
InputComponent::INPUT_CLASSES + ["h-[120px]"]

Constants included from ViewHelper

ViewHelper::ANCHOR_HELPERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Component

generate_id

Methods included from ViewHelper

#anchor_form_with, #anchor_svg, #deep_blank?, #merge_options, #popover_trigger_attributes

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Constructor Details

#initialize(form_builder:, attribute:, **kwargs) ⇒ TextAreaComponent

Returns a new instance of TextAreaComponent.



5
6
7
8
9
10
# File 'app/components/anchor/text_area_component.rb', line 5

def initialize(form_builder:, attribute:, **kwargs)
  @form_builder = form_builder
  @attribute = attribute

  super(**kwargs)
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



12
13
14
# File 'app/components/anchor/text_area_component.rb', line 12

def attribute
  @attribute
end

Instance Method Details

#optionsObject



14
15
16
17
18
19
# File 'app/components/anchor/text_area_component.rb', line 14

def options
  {
    class: INPUT_CLASSES,
    data: { testid: "text-area-#{attribute.to_s.dasherize}" },
  }
end