Class: Forms::Row
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- Forms::Row
- Defined in:
- lib/forms/row.rb
Overview
Side-by-side fields in a responsive grid: stacked on mobile, columns
across from the sm breakpoint. The class strings are literals (not
interpolated) so host Tailwind scanners pick them up.
f.row { f.field :first_name; f.field :last_name }
f.row(columns: 3) { ... }
Direct Known Subclasses
Constant Summary collapse
- COLUMN_CLASSES =
{ 2 => "sm:grid-cols-2", 3 => "sm:grid-cols-3", 4 => "sm:grid-cols-4" }.freeze
Instance Method Summary collapse
-
#initialize(columns: 2, **options) ⇒ Row
constructor
A new instance of Row.
- #view_template ⇒ Object
Constructor Details
#initialize(columns: 2, **options) ⇒ Row
Returns a new instance of Row.
17 18 19 20 21 |
# File 'lib/forms/row.rb', line 17 def initialize(columns: 2, **) @columns = columns @options = super() end |
Instance Method Details
#view_template ⇒ Object
23 24 25 |
# File 'lib/forms/row.rb', line 23 def view_template(&) div(class: row_classes, **@options.except(:class), &) end |