Raxol.Core.Renderer.Layout (Raxol v2.0.1)
View SourceCentral layout coordinator for the Raxol renderer system.
This module provides a unified interface for layout calculations and delegates to specific layout modules (Flex, Grid, etc.) based on the layout type.
Summary
Functions
Applies layout to a view or list of views, calculating absolute positions.
Creates a column layout container.
Creates a flex layout container.
Creates a grid layout container.
Calculates layout for a box container.
Calculates layout for a button element.
Calculates layout for a checkbox element.
Calculates layout for a label element.
Calculates the layout for a single view based on its type.
Calculates layout for a text element.
Creates a row layout container.
Functions
Applies layout to a view or list of views, calculating absolute positions.
Parameters
view- A single view or list of views to layoutdimensions- Available space dimensions%{width: w, height: h}
Returns
A list of positioned elements with absolute coordinates.
Creates a column layout container.
Options
:align- Alignment of children (:start,:center,:end):justify- Justification of children (:start,:center,:end,:space_between):gap- Space between children (integer):children- List of child views:style- Style options for the container
Examples
Layout.column(children: [view1, view2])
Layout.column(align: :center, justify: :space_between, children: [view1, view2])
Creates a flex layout container.
Options
:direction- Layout direction (:rowor:column):align- Alignment of children (:start,:center,:end):justify- Justification of children (:start,:center,:end,:space_between):gap- Space between children (integer):wrap- Whether to wrap children (boolean):children- List of child views:style- Style options for the container
Examples
Layout.flex(direction: :row, children: [view1, view2])
Layout.flex(direction: :column, align: :center, children: [view1, view2])
Creates a grid layout container.
Options
:columns- Number of columns or list of column sizes:rows- Number of rows or list of row sizes:gap- Gap between grid items{x, y}:align- Alignment of items within grid cells:justify- Justification of items within grid cells:children- List of child views to place in the grid
Examples
Layout.grid(columns: 3, rows: 2, children: [view1, view2, view3, view4])
Layout.grid(columns: [1, 2, 1], rows: ["auto", "1fr"], children: [view1, view2, view3])
Calculates layout for a box container.
Calculates layout for a button element.
Calculates layout for a checkbox element.
Calculates layout for a label element.
Calculates the layout for a single view based on its type.
Calculates layout for a text element.
Creates a row layout container.
Options
:align- Alignment of children (:start,:center,:end):justify- Justification of children (:start,:center,:end,:space_between):gap- Space between children (integer):children- List of child views:style- Style options for the container
Examples
Layout.row(children: [view1, view2])
Layout.row(align: :center, justify: :space_between, children: [view1, view2])