Raxol.UI.Layout.SplitPane (Raxol v2.3.0)

View Source

Layout processor for split pane elements.

Distributes available space between children by ratio, rendering divider elements between panes. Supports horizontal (side-by-side) and vertical (stacked) splits with configurable minimum sizes.

Follows the same process/3 pattern as Raxol.UI.Layout.Panels.

Summary

Functions

Creates a split pane element from a named preset.

Measures a split pane element. SplitPane fills available space.

Creates a split pane element.

Processes a split pane element, distributing space among children by ratio.

Functions

from_preset(preset, children, opts \\ [])

Creates a split pane element from a named preset.

Presets

  • :sidebar - Horizontal 2-pane, ratio {1, 3}
  • :dashboard - Horizontal outer {1, 3} with vertical inner right {3, 1}
  • :triple - Horizontal 3-pane, ratio {1, 1, 1}
  • :stacked - Vertical 2-pane, ratio {1, 1}

Examples

SplitPane.from_preset(:sidebar, [sidebar_content, main_content])

measure_split_pane(element, available_space)

Measures a split pane element. SplitPane fills available space.

new(opts \\ [])

Creates a split pane element.

Options

  • :direction - :horizontal (side-by-side) or :vertical (stacked). Default :horizontal.
  • :ratio - Tuple of integers for space distribution, e.g. {1, 2}. Default {1, 1}.
  • :min_size - Minimum pane dimension in characters. Default 5.
  • :id - Optional identifier for event targeting.
  • :children - Child elements (one per pane).

Examples

SplitPane.new(direction: :horizontal, ratio: {1, 2}, children: [left, right])

process(map, space, acc)

Processes a split pane element, distributing space among children by ratio.

Returns a list of positioned elements with absolute coordinates, including divider elements between each pane.