Class: VStackComponent

Inherits:
Component show all
Defined in:
app/components/v_stack_component.rb

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

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_sObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/components/v_stack_component.rb', line 7

def to_s
  style_parts = [
    "display:flex",
    "flex-direction:column",
    ("gap:#{spacing}px" if spacing > 0),
    ("align-items:#{align_value}" if align != "start")
  ].compact.join(";")

  opts = {}
  opts[:style] = style_parts unless style_parts.empty?

  tag.div(**opts) { @content }
end