Class: SdrViewComponents::Forms::CheckboxComponent

Inherits:
FieldComponent show all
Defined in:
app/components/sdr_view_components/forms/checkbox_component.rb

Overview

Component for form checkbox field

Instance Attribute Summary

Attributes inherited from FieldComponent

#args, #field_name, #form, #variant

Instance Method Summary collapse

Methods inherited from FieldComponent

#container_args, #container_classes, #error_args, #help_text_args, #help_text_below?, #input_args, #label_args, #label_field_name

Methods inherited from BaseComponent

#args_for, #merge_actions, #merge_classes

Constructor Details

#initialize(**args) ⇒ CheckboxComponent

Returns a new instance of CheckboxComponent.



7
8
9
10
11
12
# File 'app/components/sdr_view_components/forms/checkbox_component.rb', line 7

def initialize(**args)
  args[:container_classes] = merge_classes('form-check', args[:container_classes])
  args[:label_default_class] = 'form-check-label'
  args[:variant] = :help_text_below
  super
end

Instance Method Details

#input_componentObject



14
15
16
# File 'app/components/sdr_view_components/forms/checkbox_component.rb', line 14

def input_component
  SdrViewComponents::Forms::BasicCheckboxComponent.new(form:, field_name:, **input_args)
end