Widgets / Box & Panel

Box & Panel

A single-line border around one child; Panel adds a title row.

Box · Panel┌──────────────────────────────────────┐│ settings ││a child line ││another line│└──────────────────────────────────────┘┌──────────────────────────────────────┐│ plain box │

Signature

Box.box (style: Style) (children: LayoutNode<'msg> list) : LayoutNode<'msg>
Box.panel (title: string) (style: Style) (children: LayoutNode<'msg> list) : LayoutNode<'msg>

Parameters

parameter type what it is
title string Panel only — the label drawn into the top border.
style Style The border color. Use theme.border, or theme.borderFocus for a focused pane.
children LayoutNode list Box renders one child filling the inner rect; flow several through a Stack.

Notes

A Box draws a border and gives its inner rect to a single child — pass multiple children and they overlap, so wrap them in a Stack. Swap the border style for theme.borderFocus to show which pane has focus.

Example

Box.panel "settings" theme.border
    [ Toggle.checkbox theme.fg true "wrap lines"
      Toggle.checkbox theme.fg false "show line numbers" ]