Class: BulmaPhlex::Columns

Inherits:
Base
  • Object
show all
Defined in:
lib/bulma_phlex/columns.rb

Overview

Renders a responsive column layout using [Bulma’s column system](bulma.io/documentation/columns/basics/).

Supports options for breakpoint, alignment (centered, vertically centered), layout (multiline, gap sizing), and responsive gap configuration per breakpoint.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(minimum_breakpoint: nil, multiline: false, gap: nil, centered: false, vcentered: false, **html_attributes) ⇒ Columns

Returns a new instance of Columns.



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/bulma_phlex/columns.rb', line 27

def initialize(minimum_breakpoint: nil,
               multiline: false,
               gap: nil,
               centered: false,
               vcentered: false,
               **html_attributes)
  @minimum_breakpoint = minimum_breakpoint
  @multiline = multiline
  @gap = gap
  @centered = centered
  @vcentered = vcentered
  @html_attributes = html_attributes
end

Class Method Details

.new(minimum_breakpoint: nil, multiline: false, gap: nil, centered: false, vcentered: false, **html_attributes) ⇒ Object

Parameters

  • ‘minimum_breakpoint` — Sets the minimum breakpoint for the columns (e.g. `:tablet`, `:desktop`)

  • ‘multiline` — If `true`, allows the columns to wrap onto multiple lines

  • ‘gap` — An integer (0-8) to set the gap size, or a hash keyed by breakpoints for responsive gaps

  • ‘centered` — If `true`, centers the columns

  • ‘vcentered` — If `true`, vertically centers the columns

  • ‘**html_attributes` — Additional HTML attributes for the columns container



18
19
20
21
22
23
24
25
# File 'lib/bulma_phlex/columns.rb', line 18

def self.new(minimum_breakpoint: nil,
             multiline: false,
             gap: nil,
             centered: false,
             vcentered: false,
             **html_attributes)
  super
end

Instance Method Details

#view_templateObject



41
42
43
# File 'lib/bulma_phlex/columns.rb', line 41

def view_template(&)
  div(**mix({ class: columns_classes }, @html_attributes), &)
end