types

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeView

func ChangeView(view View) tea.Cmd

func ChangeViewWithMsgs

func ChangeViewWithMsgs(view View, msgs ...tea.Msg) tea.Cmd

func KeyHandled

func KeyHandled(key tea.KeyMsg) tea.Cmd

func ViewEnter

func ViewEnter(from View) tea.Cmd

func WrapError

func WrapError(err error) tea.Cmd

Types

type MsgError

type MsgError struct {
	Operation string
	Err       error
}

sent when a recoverable error occurs (displayed to user)

func AsMsgError

func AsMsgError(err error) MsgError

type MsgKeyHandled

type MsgKeyHandled tea.KeyMsg

sent when the view has handled a key input

type MsgViewChange

type MsgViewChange struct {
	View View
	Msgs []tea.Msg
}

send to change the current state; Msgs are optional messages to forward to the destination view

type MsgViewEnter

type MsgViewEnter View

sent to a state when it is entered, with the view we're leaving

type View

type View int
const (
	ViewChat View = iota
	ViewConversations
	ViewSettings
)

type ViewModel

type ViewModel interface {
	Init() tea.Cmd
	Update(tea.Msg) (ViewModel, tea.Cmd)

	// The view's header
	Header(width int) string
	// The view's main content, which is given given height to render into
	Content(width, height int, errors string) string
	// The view's footer
	Footer(width int) string
}

An analogue to tea.Model with separate header, content, and footer sections

Jump to

Keyboard shortcuts

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