Skip to content

Panel

Panel preview

Panel is a container with rounded borders and optional title. It delegates focus and input handling to its content.

Constructor func NewPanel() *Panel

Usage

panel := components.NewPanel().
SetTitle("Settings").
SetTitleAlign(components.AlignLeft)
fmt.Println(panel != nil)

Methods

Method Signature Description
GetContent func (p *Panel) GetContent() tview.Primitive GetContent returns the inner content primitive.
IsFocused func (p *Panel) IsFocused() bool IsFocused returns the manual focus state.
SetContent func (p *Panel) SetContent(content tview.Primitive) *Panel SetContent sets the inner content primitive.
SetFocused func (p *Panel) SetFocused(focused bool) *Panel SetFocused sets the manual focus state for visual indication. When focused, the panel border uses the accent color.
SetTitle func (p *Panel) SetTitle(title string) *Panel SetTitle sets the title displayed in the top border.
SetTitleAlign func (p *Panel) SetTitleAlign(align TitleAlign) *Panel SetTitleAlign sets the title alignment (Left, Center, or Right).
SetTitleColor func (p *Panel) SetTitleColor(color tcell.Color) *Panel SetTitleColor overrides the title color. Pass 0 to use theme default.

Types

type TitleAlign TitleAlign is an alias for Align for backward compatibility.