layout

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package layout provides tile-based layout management using teatile. It ensures consistent dimension handling between sidebar and content, preventing rendering glitches when content overflows.

Index

Constants

View Source
const (
	// HeaderHeight is the fixed height for the header tile
	HeaderHeight = 3
	// FooterHeight is the fixed height for the footer tile
	FooterHeight = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Layout

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

Layout manages the tile hierarchy for the application

func New

func New() *Layout

New creates a new tile-based layout manager

func (*Layout) ContentHeight

func (l *Layout) ContentHeight() int

ContentHeight returns the height available for content (excluding header/footer)

func (*Layout) ContentSize

func (l *Layout) ContentSize() (width, height int)

ContentSize returns the content tile dimensions

func (*Layout) ContentStyle

func (l *Layout) ContentStyle(style lipgloss.Style) lipgloss.Style

ContentStyle returns a lipgloss style with content dimensions applied

func (*Layout) ContentWidth

func (l *Layout) ContentWidth() int

ContentWidth returns the width available for main content When sidebar is inactive, returns full content width. When sidebar is active, returns content width minus sidebar width.

func (*Layout) FooterSize

func (l *Layout) FooterSize() (width, height int)

FooterSize returns the footer tile dimensions

func (*Layout) FooterStyle

func (l *Layout) FooterStyle(style lipgloss.Style) lipgloss.Style

FooterStyle returns a lipgloss style with footer dimensions applied

func (*Layout) HeaderSize

func (l *Layout) HeaderSize() (width, height int)

HeaderSize returns the header tile dimensions

func (*Layout) HeaderStyle

func (l *Layout) HeaderStyle(style lipgloss.Style) lipgloss.Style

HeaderStyle returns a lipgloss style with header dimensions applied

func (*Layout) IsSidebarActive

func (l *Layout) IsSidebarActive() bool

IsSidebarActive returns whether the sidebar is currently visible

func (*Layout) MainSize

func (l *Layout) MainSize() (width, height int)

MainSize returns the main content tile dimensions

func (*Layout) MainStyle

func (l *Layout) MainStyle(style lipgloss.Style) lipgloss.Style

MainStyle returns a lipgloss style with main content dimensions applied

func (*Layout) SetSidebarActive

func (l *Layout) SetSidebarActive(active bool)

SetSidebarActive controls whether the sidebar is visible

func (*Layout) SetSidebarWidth

func (l *Layout) SetSidebarWidth(width int)

SetSidebarWidth sets the sidebar width (use 0 to hide)

func (*Layout) SetSize

func (l *Layout) SetSize(width, height int)

SetSize updates the root tile dimensions and recalculates the layout

func (*Layout) SidebarSize

func (l *Layout) SidebarSize() (width, height int)

SidebarSize returns the sidebar tile dimensions

func (*Layout) SidebarStyle

func (l *Layout) SidebarStyle(style lipgloss.Style) lipgloss.Style

SidebarStyle returns a lipgloss style with sidebar dimensions applied

Jump to

Keyboard shortcuts

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