Class: UI::InputComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
InputBehavior
Defined in:
app/view_components/ui/input_component.rb

Instance Method Summary collapse

Methods included from InputBehavior

#input_classes, #input_html_attributes

Constructor Details

#initialize(type: "text", placeholder: nil, value: nil, name: nil, id: nil, classes: "", **attributes) ⇒ InputComponent

Returns a new instance of InputComponent.



6
7
8
9
10
11
12
13
14
# File 'app/view_components/ui/input_component.rb', line 6

def initialize(type: "text", placeholder: nil, value: nil, name: nil, id: nil, classes: "", **attributes)
  @type = type
  @placeholder = placeholder
  @value = value
  @name = name
  @id = id
  @classes = classes
  @attributes = attributes
end

Instance Method Details

#callObject



16
17
18
# File 'app/view_components/ui/input_component.rb', line 16

def call
  tag.input(**input_html_attributes.merge(@attributes))
end