Raxol.Core.Renderer.View.Layout.Grid (Raxol v0.4.0)

View Source

Handles grid-based layouts for the Raxol view system. Provides functionality for creating and managing grid layouts with customizable columns and rows.

Summary

Functions

Adds a child to the grid at the specified position.

Calculates the layout of a grid.

Creates a new grid layout.

Functions

add_child(grid, child, arg)

Adds a child to the grid at the specified position.

calculate_layout(grid, available_size)

Calculates the layout of a grid.

new(opts \\ [])

Creates a new grid layout.

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

Grid.new(columns: 3, rows: 2)
Grid.new(columns: [1, 2, 1], rows: ["auto", "1fr"])