Help us shape the future of Go! Take the 2026 Go Developer Survey

container

package
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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

Modal displays overlay dialogs for user interaction

func NewModal

func NewModal(opts ...ModalOption) *Modal

NewModal creates a new modal dialog

func (*Modal) Blur

func (m *Modal) Blur()

Blur is called when this component loses focus

func (*Modal) Focus

func (m *Modal) Focus()

Focus is called when this component receives focus

func (*Modal) Focused

func (m *Modal) Focused() bool

Focused returns whether this component is currently focused

func (*Modal) Hide

func (m *Modal) Hide()

Hide conceals the modal

func (*Modal) Init

func (m *Modal) Init() tea.Cmd

Init initializes the modal

func (*Modal) IsVisible

func (m *Modal) IsVisible() bool

IsVisible returns whether the modal is currently visible

func (*Modal) SetMessage

func (m *Modal) SetMessage(message string)

SetMessage updates the modal message

func (*Modal) SetTitle

func (m *Modal) SetTitle(title string)

SetTitle updates the modal title

func (*Modal) Show

func (m *Modal) Show()

Show displays the modal

func (*Modal) ShowAlert

func (m *Modal) ShowAlert(title, message string, onOK func() tea.Cmd)

ShowAlert displays an alert modal

func (*Modal) ShowConfirm

func (m *Modal) ShowConfirm(title, message string, onYes, onNo func() tea.Cmd)

ShowConfirm displays a confirmation modal

func (*Modal) ShowInput

func (m *Modal) ShowInput(title, message, placeholder string, onOK func(string) tea.Cmd, onCancel func() tea.Cmd)

ShowInput displays an input modal

func (*Modal) Update

func (m *Modal) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles messages

func (*Modal) View

func (m *Modal) View() string

View renders the modal

type ModalButton

type ModalButton struct {
	Label  string
	Action func(string) tea.Cmd // Input value passed for ModalInput, empty string otherwise
}

ModalButton represents a button in the modal

type ModalOption

type ModalOption func(*Modal)

ModalOption configures a Modal

func WithModalButtons

func WithModalButtons(buttons []ModalButton) ModalOption

WithModalButtons sets custom buttons

func WithModalInput

func WithModalInput(placeholder string) ModalOption

WithModalInput enables text input (for ModalInput type)

func WithModalMessage

func WithModalMessage(message string) ModalOption

WithModalMessage sets the modal message

func WithModalOnCancel

func WithModalOnCancel(fn func() tea.Cmd) ModalOption

WithModalOnCancel sets the cancel callback

func WithModalOnConfirm

func WithModalOnConfirm(fn func(string) tea.Cmd) ModalOption

WithModalOnConfirm sets the confirm callback

func WithModalTitle

func WithModalTitle(title string) ModalOption

WithModalTitle sets the modal title

func WithModalType

func WithModalType(t ModalType) ModalOption

WithModalType sets the modal type

type ModalType

type ModalType int

ModalType defines the type of modal dialog

const (
	// ModalAlert shows a message with an OK button
	ModalAlert ModalType = iota
	// ModalConfirm shows a message with Yes/No or OK/Cancel buttons
	ModalConfirm
	// ModalInput shows a message with a text input field
	ModalInput
)

type SplitDirection

type SplitDirection int

SplitDirection controls how panes are arranged.

const (
	// SplitHorizontal renders panes side-by-side (left/right).
	SplitHorizontal SplitDirection = iota
	// SplitVertical renders panes stacked (top/bottom).
	SplitVertical
)

type SplitPane

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

SplitPane renders two components in a resizable split layout.

func NewSplitPane

func NewSplitPane(opts ...SplitPaneOption) *SplitPane

NewSplitPane creates a split pane with defaults.

func (*SplitPane) Blur

func (s *SplitPane) Blur()

Blur marks the split pane as unfocused.

func (*SplitPane) EnterResizeMode

func (s *SplitPane) EnterResizeMode()

EnterResizeMode enables resize mode.

func (*SplitPane) ExitResizeMode

func (s *SplitPane) ExitResizeMode()

ExitResizeMode disables resize mode.

func (*SplitPane) Focus

func (s *SplitPane) Focus()

Focus marks the split pane as focused.

func (*SplitPane) FocusBottom

func (s *SplitPane) FocusBottom()

FocusBottom focuses the bottom pane (alias of right in vertical mode).

func (*SplitPane) FocusLeft

func (s *SplitPane) FocusLeft()

FocusLeft focuses the left pane.

func (*SplitPane) FocusRight

func (s *SplitPane) FocusRight()

FocusRight focuses the right pane.

func (*SplitPane) FocusTop

func (s *SplitPane) FocusTop()

FocusTop focuses the top pane (alias of left in vertical mode).

func (*SplitPane) Focused

func (s *SplitPane) Focused() bool

Focused reports focus state.

func (*SplitPane) GetFocusedPane

func (s *SplitPane) GetFocusedPane() int

GetFocusedPane returns the focused pane index (0 or 1).

func (*SplitPane) GetRatio

func (s *SplitPane) GetRatio() float64

GetRatio returns the active split ratio.

func (*SplitPane) Init

func (s *SplitPane) Init() tea.Cmd

Init initializes child components.

func (*SplitPane) IsResizing

func (s *SplitPane) IsResizing() bool

IsResizing reports whether resize mode is active.

func (*SplitPane) SetLeftComponent

func (s *SplitPane) SetLeftComponent(c tui.Component)

SetLeftComponent sets the left/top child component.

func (*SplitPane) SetRatio

func (s *SplitPane) SetRatio(r float64)

SetRatio sets the split ratio using configured min/max bounds.

func (*SplitPane) SetRightComponent

func (s *SplitPane) SetRightComponent(c tui.Component)

SetRightComponent sets the right/bottom child component.

func (*SplitPane) ToggleFocus

func (s *SplitPane) ToggleFocus()

ToggleFocus switches focus between panes.

func (*SplitPane) Update

func (s *SplitPane) Update(msg tea.Msg) (tui.Component, tea.Cmd)

Update handles layout, keyboard controls, and delegates to child panes.

func (*SplitPane) View

func (s *SplitPane) View() string

View renders the split pane.

type SplitPaneOption

type SplitPaneOption func(*SplitPane)

SplitPaneOption configures a SplitPane.

func WithBottomComponent

func WithBottomComponent(c tui.Component) SplitPaneOption

WithBottomComponent sets the bottom pane component (alias for right in vertical mode).

func WithDirection

func WithDirection(d SplitDirection) SplitPaneOption

WithDirection sets split direction.

func WithDividerChar

func WithDividerChar(ch string) SplitPaneOption

WithDividerChar sets the divider character/string.

func WithLeftComponent

func WithLeftComponent(c tui.Component) SplitPaneOption

WithLeftComponent sets the left pane component.

func WithMinMaxRatio

func WithMinMaxRatio(min, max float64) SplitPaneOption

WithMinMaxRatio sets minimum and maximum ratio bounds.

func WithRatio

func WithRatio(r float64) SplitPaneOption

WithRatio sets split ratio.

func WithRightComponent

func WithRightComponent(c tui.Component) SplitPaneOption

WithRightComponent sets the right pane component.

func WithShowDivider

func WithShowDivider(show bool) SplitPaneOption

WithShowDivider toggles divider visibility.

func WithSplitPaneDesignTokens

func WithSplitPaneDesignTokens(tokens *design.DesignTokens) SplitPaneOption

WithSplitPaneDesignTokens applies design-system tokens.

func WithSplitPaneTheme

func WithSplitPaneTheme(theme string) SplitPaneOption

WithSplitPaneTheme applies a named theme.

func WithTopComponent

func WithTopComponent(c tui.Component) SplitPaneOption

WithTopComponent sets the top pane component (alias for left in vertical mode).

Jump to

Keyboard shortcuts

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