Skip to main content

Module style

Module style 

Source
Expand description

BoxStyle: a Lip-Gloss-style box model (padding, border, margin).

Renders content into a standalone Grid, independent of any Backend/Terminal.

For a box drawn straight into a Surface you already own – with titles, BorderType glyph sets, and theming – use Panel instead. Reach for BoxStyle when composing a box outside a frame, laying boxes out with join_h/join_v, or needing margin (space outside the border, which Panel has no concept of).

BoxStyle does not word-wrap: it lays out already-broken lines (only '\n' is treated specially).

For word-wrapping text to a width first, use Paragraph, then hand the wrapped result to BoxStyle::render. Keeping wrapping and box-model layout separate avoids tying every consumer of this module to Paragraph or the egc feature.

Structs§

BoxStyle
A box-model wrapper: content, padding, an optional single-line border, and margin, rendered into a standalone Grid via BoxStyle::render.
Boxed
Pairs a BoxStyle with the text it should render, so the pair can implement Widget (which has no room for a text parameter). Build one via BoxStyle::text.
Sides
CSS-style box-model sides: top/right/bottom/left, in terminal cells.