sigildocs

(sigil tui layout)

(sigil tui layout) - Layout algorithm for TUI components

UI descriptions are tagged lists returned by constructor functions. The layout algorithm recursively divides available rectangles and produces a flat list of render commands: (render-type x y w h ...)

(vertical-split 0.3
  (panel "Roster" (selectable-list contacts selected))
  (panel "Chat" (text messages)))

Exports

Split space horizontally (side by side) at the given ratio. ratio is the fraction of width for the left child (0.0-1.0).

Split space vertically (top/bottom) at the given ratio. ratio is the fraction of height for the top child (0.0-1.0).

panelprocedure

A bordered panel with an optional title. Insets child by 1 on all sides.

text-blockprocedure

A block of text lines with style. lines is a list of (string fg bg attrs) tuples.

A selectable list of items with a highlight index. items is a list of (string fg bg attrs) tuples.

scrollableprocedure

A scrollable view with a scroll offset. child is a text-block or similar content widget.

status-barprocedure

A status bar with left, center, and right text.

A text input widget showing the current input state. prompt is the prompt string, value is current text, cursor is cursor position in value.

fillerprocedure

An empty filler that takes up space.

layout-treeprocedure

Lay out a UI tree into a flat list of render commands.

Each render command is (type x y w h ...extra-data). The renderer processes these sequentially to draw into the grid.