Documentation
¶
Index ¶
Constants ¶
const ( Yellow = "178" Orange = "166" DarkOrange = "136" )
const BoxChrome = 4
BoxChrome is the horizontal space the border itself eats: "│ " + content + " │". Callers sizing a box against the terminal subtract this from the available columns.
Variables ¶
var ( QuestionIcon = lipgloss.NewStyle().Foreground(lipgloss.Color("251")).SetString("? ").Bold(true) CrossIcon = lipgloss.NewStyle().Foreground(lipgloss.Color("9")).SetString("✗ ").Bold(true) TickIcon = lipgloss.NewStyle().Foreground(lipgloss.Color(Yellow)).SetString("✓ ").Bold(true) TodoIcon = lipgloss.NewStyle().SetString("• ").Bold(true) DoubleRightIcon = lipgloss.NewStyle().Foreground(lipgloss.Color("251")).SetString("» ").Bold(true) ChevronIcon = lipgloss.NewStyle().Foreground(lipgloss.Color("251")).SetString("› ").Bold(true) )
var Container = lipgloss.NewStyle().Border(lipgloss.NormalBorder()).Padding(1, 2).BorderForeground(lipgloss.Color("#ff8c00"))
Functions ¶
func ForegroundPrint ¶
func MultiSectionBox ¶
MultiSectionBox renders every section inside ONE continuous bordered box instead of one per section: the first title sits on the top border, later ones on a divider line (`├─ Title ──┤`) instead of their own top+bottom border. The box width fits the widest title/body line across all sections, so later sections can widen the whole box on the next render.
func MultiSectionBoxOpts ¶
MultiSectionBoxOpts renders sections per opts and reports the inner width it settled on, so a caller splitting one box across several renders can pass that width back in and keep the pieces aligned.
func ProgressBar ¶
ProgressBar renders a fixed-width filled/empty block bar plus a right-aligned percentage, e.g. "████████░░░░░░░░░░░░░░░░ 42%".
Types ¶
type BoxOpts ¶
type BoxOpts struct {
// MaxWidth clamps the box's total width, borders included. 0 means the
// content decides. A box wider than the terminal gets hard-truncated by
// bubbletea's renderer, which eats the right border off the long rows and
// hides the tail of whatever error produced them.
MaxWidth int
// InnerWidth forces the content width instead of deriving it from the
// widest line. Keeps every piece of a split box the same width, since
// pieces already in scrollback can't be re-rendered.
InnerWidth int
// Continued opens with a "├─ Title ─┤" divider instead of a "╭" corner,
// because earlier sections were already printed above.
Continued bool
// Open omits the closing "╰──╯" because more sections follow below.
Open bool
}
BoxOpts tunes MultiSectionBoxOpts for a box rendered in pieces (see phasebox.Model, which commits finished sections to scrollback and keeps only the live one in the frame).