Class: Railsboot::FormFieldComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/form_field_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(form:, floating: false, **html_attributes) ⇒ FormFieldComponent

Returns a new instance of FormFieldComponent.



60
61
62
63
64
65
66
67
68
69
# File 'app/components/railsboot/form_field_component.rb', line 60

def initialize(form:, floating: false, **html_attributes)
  @form = form
  @floating = floating
  @html_attributes = html_attributes

  @html_attributes[:class] = class_names(
    ("form-floating" if @floating),
    html_attributes.delete(:class)
  )
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'app/components/railsboot/form_field_component.rb', line 71

def render?
  @form.present?
end