Class: Railsboot::FormField::EmailFieldComponent
- Inherits:
-
FieldComponent
- Object
- FieldComponent
- Railsboot::FormField::EmailFieldComponent
- Defined in:
- app/components/railsboot/form_field/email_field_component.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(form:, name:, size: DEFAULT_SIZE, **html_attributes) ⇒ EmailFieldComponent
constructor
A new instance of EmailFieldComponent.
Constructor Details
#initialize(form:, name:, size: DEFAULT_SIZE, **html_attributes) ⇒ EmailFieldComponent
Returns a new instance of EmailFieldComponent.
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/components/railsboot/form_field/email_field_component.rb', line 2 def initialize(form:, name:, size: DEFAULT_SIZE, **html_attributes) @form = form @name = name @size = fetch_or_fallback(size, SIZES, DEFAULT_SIZE) @html_attributes = html_attributes @html_attributes[:class] = class_names( "form-control", {"form-control-#{@size}" => @size.present?}, html_attributes[:class] ) end |
Instance Method Details
#call ⇒ Object
15 16 17 |
# File 'app/components/railsboot/form_field/email_field_component.rb', line 15 def call @form.email_field @name, **@html_attributes end |