Class: Superform::Rails::Components::LabelComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
lib/superform/rails.rb

Instance Attribute Summary

Attributes inherited from BaseComponent

#dom, #field

Instance Method Summary collapse

Methods inherited from BaseComponent

#focus, #initialize

Constructor Details

This class inherits a constructor from Superform::Rails::Components::BaseComponent

Instance Method Details

#field_attributesObject



239
240
241
# File 'lib/superform/rails.rb', line 239

def field_attributes
  { for: dom.id }
end

#template(&content) ⇒ Object



234
235
236
237
# File 'lib/superform/rails.rb', line 234

def template(&content)
  content ||= Proc.new { field.key.to_s.titleize }
  label(**attributes, &content)
end