MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / boxWithTitle

Function boxWithTitle

internal/tui/views/utils.go:42–52  ·  view source on GitHub ↗

boxWithTitle renders content in a rounded-border box whose title is embedded in the top border line: ╭─ Title ─────────────────────────────╮ │ content │ ╰──────────────────────────────────────╯ styledTitle may contain ANSI escape codes; pass "" for a plain box. tota

(styledTitle string, content string, borderColor lipgloss.Color, totalWidth int)

Source from the content-addressed store, hash-verified

40// styledTitle may contain ANSI escape codes; pass "" for a plain box.
41// totalWidth is the full rendered width including the border characters.
42func boxWithTitle(styledTitle string, content string, borderColor lipgloss.Color, totalWidth int) string {
43 style := lipgloss.NewStyle().
44 Border(lipgloss.RoundedBorder()).
45 BorderForeground(borderColor).
46 Width(totalWidth - 2)
47 rendered := style.Render(content)
48 if styledTitle == "" {
49 return rendered
50 }
51 return injectBorderTitle(rendered, styledTitle, lipgloss.Width(styledTitle), borderColor)
52}
53
54// boxWithTitleMinHeight is like boxWithTitle but forces the box to be at least
55// minHeight terminal lines tall (including the two border lines). Content

Callers 8

renderNavHeaderFunction · 0.85
renderCommandMethod · 0.85
renderSuggestionsMethod · 0.85
renderPriceDetailsMethod · 0.85
renderHelpMethod · 0.85
RenderMethod · 0.85
RenderMethod · 0.85
RenderMethod · 0.85

Calls 2

injectBorderTitleFunction · 0.85
RenderMethod · 0.45

Tested by

no test coverage detected