(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
horizontal-splitprocedureSplit space horizontally (side by side) at the given ratio. ratio is the fraction of width for the left child (0.0-1.0).
vertical-splitprocedureSplit space vertically (top/bottom) at the given ratio. ratio is the fraction of height for the top child (0.0-1.0).
panelprocedureA bordered panel with an optional title. Insets child by 1 on all sides.
text-blockprocedureA block of text lines with style. lines is a list of (string fg bg attrs) tuples.
selectable-listprocedureA selectable list of items with a highlight index. items is a list of (string fg bg attrs) tuples.
scrollableprocedureA scrollable view with a scroll offset. child is a text-block or similar content widget.
status-barprocedureA status bar with left, center, and right text.
text-input-widgetprocedureA text input widget showing the current input state. prompt is the prompt string, value is current text, cursor is cursor position in value.
fillerprocedureAn empty filler that takes up space.
layout-treeprocedureLay 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.