Documentation
¶
Overview ¶
Package titlebox draws a rounded box with its title embedded in the top border - "╭ title ─────╮" - around a body the caller has already rendered. It is a framing primitive kept apart so any overlay wanting a labeled panel can reuse it without depending on a particular form.
The widget is style-agnostic: the border and title colors arrive through Styles, so a caller signals focus by handing it a different pair. It never truncates the body - a caller sizes its content to width minus Chrome and the box pads each line out to the interior.
Index ¶
Constants ¶
const Chrome = borderCols + 2*hPad
Chrome is the columns a titled box spends on its border and padding. A caller sizes the body it renders to the box width minus Chrome, so its content fills the interior exactly without overrunning the frame.
const Inset = 1 + hPad
Inset is the columns between the box's left edge and its body - the left border glyph plus the left padding - so a caller can map a click on the box onto body coordinates.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render draws body inside a rounded box with title embedded in the top border ("╭ title ─────╮"). width is the box's total column count (border included); body is padded - never truncated - to the interior, so size it to width-Chrome. A blank title, or one too wide for the interior, draws a plain top edge. Multi-line bodies box every line.