tui

package module
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

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

Application represents the main TUI application.

func NewApplication

func NewApplication() *Application

NewApplication creates a new TUI application.

func (*Application) AddComponent

func (a *Application) AddComponent(c Component)

AddComponent adds a component to the application.

func (*Application) FocusComponent

func (a *Application) FocusComponent(index int)

FocusComponent focuses a specific component by index, blurring the currently focused one.

func (*Application) Init

func (a *Application) Init() tea.Cmd

Init initializes the application.

func (*Application) Update

func (a *Application) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages.

func (*Application) View

func (a *Application) View() string

View renders the application.

type Component

type Component interface {
	// Init initializes the component.
	Init() tea.Cmd

	// Update handles messages and updates component state.
	Update(msg tea.Msg) (Component, tea.Cmd)

	// View renders the component.
	View() string

	// Focus is called when this component receives focus.
	Focus()

	// Blur is called when this component loses focus.
	Blur()

	// Focused returns whether this component is currently focused.
	Focused() bool
}

Component is the interface all TUI components must implement.

Directories

Path Synopsis
examples
showcase command
Package spinner provides a library of terminal spinner animations.
Package spinner provides a library of terminal spinner animations.

Jump to

Keyboard shortcuts

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