Class: UI::Field
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::Field
- Includes:
- FieldBehavior
- Defined in:
- app/components/ui/field.rb
Overview
Field - Phlex implementation
Core wrapper for a single form field with support for different orientations. Uses FieldBehavior concern for shared styling logic.
Instance Method Summary collapse
-
#initialize(orientation: "vertical", data_invalid: nil, classes: "", **attributes) ⇒ Field
constructor
A new instance of Field.
- #view_template(&block) ⇒ Object
Methods included from FieldBehavior
#field_classes, #field_html_attributes
Constructor Details
#initialize(orientation: "vertical", data_invalid: nil, classes: "", **attributes) ⇒ Field
Returns a new instance of Field.
23 24 25 26 27 28 |
# File 'app/components/ui/field.rb', line 23 def initialize(orientation: "vertical", data_invalid: nil, classes: "", **attributes) @orientation = orientation @data_invalid = data_invalid @classes = classes @attributes = attributes end |
Instance Method Details
#view_template(&block) ⇒ Object
30 31 32 33 34 |
# File 'app/components/ui/field.rb', line 30 def view_template(&block) div(**field_html_attributes) do yield if block_given? end end |