Class: InputComponent
- Defined in:
- app/components/input_component.rb
Overview
Input — text input fields with icon, labeled, and action variants.
Usage:
Input(placeholder: "Search...", icon: "search")
Input(icon: "users", icon_position: "left", placeholder: "Find users...")
Input(labeled: true) { text "$" }
Input(name: "email", label: "Email", placeholder: "you@example.com")
Input(name: "password", label: "Password", input_type: "password")
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
Methods inherited from Component
default, #initialize, #render_in, slot
Constructor Details
This class inherits a constructor from Component
Instance Method Details
#to_s ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/components/input_component.rb', line 31 def to_s input_field = input_element if label tag.div(class: "field") { safe_join([ tag.label(label, for: id || name), input_field ]) } else input_field end end |