Class: Yattho::Forms::FormControl

Inherits:
BaseComponent show all
Defined in:
lib/yattho/forms/form_control.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes included from ActsAsComponent

#template_root_path

Instance Method Summary collapse

Methods inherited from BaseComponent

#content, inherited, #input?, #perform_render, #render?, #to_component, #type

Methods included from ActsAsComponent

#compile!, extended, #renders_templates

Methods included from ClassNameHelper

#class_names

Constructor Details

#initialize(input:) ⇒ FormControl

Returns a new instance of FormControl.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/yattho/forms/form_control.rb', line 9

def initialize(input:)
  @input = input
  @input.add_label_classes("FormControl-label")
  @form_group_arguments = {
    class: class_names(
      "FormControl",
      "flex-1",
      "width-full",
      "FormControl--fullWidth" => @input.full_width?
    )
  }

  @form_group_arguments[:hidden] = "hidden" if @input.hidden?
end