Raxol.Core.Renderer.View.Components.Box (Raxol v0.4.0)

View Source

Handles box layout functionality for the Raxol view system. Provides box model layout with content, padding, border, and margin.

Summary

Functions

Calculates the layout of a box and its children.

Creates a new box view.

Functions

calculate_layout(box, available_size)

Calculates the layout of a box and its children.

new(opts \\ [])

Creates a new box view.

Options

  • :children - List of child views
  • :padding - Padding around content (integer or {top, right, bottom, left})
  • :margin - Margin around box (integer or {top, right, bottom, left})
  • :border - Border style (:none, :single, :double, :rounded, :bold, :dashed)
  • :fg - Foreground color
  • :bg - Background color
  • :size - Box size {width, height}

Examples

Box.new(children: [view1, view2], padding: 1)
Box.new(padding: {1, 2, 1, 2}, border: :single)