Class: Irelia::Form::Group::Component

Inherits:
Base::Component
  • Object
show all
Defined in:
app/components/irelia/form/group/component.rb

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Component

Returns a new instance of Component.



4
5
6
7
8
# File 'app/components/irelia/form/group/component.rb', line 4

def initialize(**options)
  super

  add_css_classes "irelia-form__group--invalid" if errors.present?
end

Instance Method Details

#group_idObject



16
17
18
# File 'app/components/irelia/form/group/component.rb', line 16

def group_id
  "#{object_name}_#{method}_group"
end

#group_optionsObject



10
11
12
13
14
# File 'app/components/irelia/form/group/component.rb', line 10

def group_options
  html_options.merge(
    id: group_id
  )
end

#variantsObject



20
21
22
23
24
25
# File 'app/components/irelia/form/group/component.rb', line 20

def variants
  class_names(
    "irelia-form__group",
    "irelia-form__group--default": variant == :default
  )
end