Raxol.Core.Renderer.View.LayoutHelpers (Raxol v2.0.1)

View Source

Layout helper functions for the View module. Extracted from the main View module to improve maintainability.

Summary

Functions

Calculates flex layout dimensions based on the given constraints. Returns a map with calculated width and height.

Creates a new panel view (box with border and children).

Functions

flex(constraints)

@spec flex(map()) :: %{width: integer(), height: integer()}

Calculates flex layout dimensions based on the given constraints. Returns a map with calculated width and height.

panel(opts \\ [])

Creates a new panel view (box with border and children).

Options

  • :children - Child views
  • :border - Border style (default: :single)
  • :padding - Padding inside the panel (default: 1)
  • :style - Additional style options
  • :title - Optional title for the panel
  • :fg - Foreground color
  • :bg - Background color

Examples

LayoutHelpers.panel(children: [View.text("Hello")])
LayoutHelpers.panel(border: :double, title: "Panel")

NOTE: Only panel/1 (with a keyword list) is supported. Update any panel/2 usages to panel/1.