class RatatuiRuby::Layout::Layout
Divides an area into smaller chunks.
Terminal screens vary in size. Hardcoded positions break when the window resizes. You need a way to organize space dynamically.
This class manages geometry. It splits a given area into multiple sections based on a list of constraints.
Use layouts to build responsive grids. Stack sections vertically for a sidebar-main structure. Partition them horizontally for headers and footers. Let the layout engine do the math.
Example
Run the interactive demo from the terminal:
ruby examples/widget_layout_split/app.rb
Attributes
Widgets to render in each section (optional).
If provided, ‘children` is rendered into the area defined by `constraints`.
Array of rules defining section sizes.
Direction of the split.
Either :vertical (top to bottom) or :horizontal (left to right).
layout.direction # => :vertical
Strategy for distributing extra space.
One of :legacy, :start, :center, :end, :space_between, :space_around.
