panel

package
v0.0.0-...-0fa4d78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

tui/panel/panel.go

Package panel renders a titled key-value detail card. It is the standard presentation for "show one thing" command output (a credential profile, an endpoint, a configuration). Rich mode draws a bordered card with the title embedded in the top border, vertical breathing room, and aligned muted labels; Plain and Agent modes degrade to aligned label/value lines with no decoration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Panel

type Panel struct {
	// contains filtered or unexported fields
}

Panel is a fluent builder for a titled key-value card.

func New

func New(title string) *Panel

New returns an empty Panel. An empty title renders a card without a heading.

func (*Panel) Field

func (p *Panel) Field(label, value string) *Panel

Field appends one label/value pair. Values may be pre-styled (badges, colored text); alignment is ANSI-aware.

func (*Panel) FieldIf

func (p *Panel) FieldIf(present bool, label, value string) *Panel

FieldIf appends the pair only when present is true. Convenience for optional fields so call sites stay fluent.

func (*Panel) Render

func (p *Panel) Render() string

Render returns the panel as a string, respecting the active output mode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL