form

package
v0.0.0-...-69c762e Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DialogPadding dialog inner padding.
	DialogPadding = 3

	// DialogHelpHeight dialog help text height.
	DialogHelpHeight = 1

	// DialogMinWidth dialog min width.
	DialogMinWidth = 40

	// FormHeightOffset form height offset for border.
	FormHeightOffset = 3
)

Variables

This section is empty.

Functions

func EmptyBoxSpace

func EmptyBoxSpace(bgColor tcell.Color) *tview.Box

EmptyBoxSpace creates an empty box with the specified background color.

Types

type Form

type Form struct {
	*tview.Box
	// contains filtered or unexported fields
}

Form is a modal form component with a title, form fields, and help text.

func NewForm

func NewForm(title string) *Form

NewForm creates a new form with the given title.

func (*Form) AddButton

func (f *Form) AddButton(label string, selected func()) *Form

AddButton adds a button to the form.

func (*Form) AddCheckbox

func (f *Form) AddCheckbox(label string, checked bool, changed func(checked bool)) *Form

AddCheckbox adds a checkbox to the form.

func (*Form) AddInputField

func (f *Form) AddInputField(label, value string, fieldWidth int, accept func(textToCheck string, lastChar rune) bool, changed func(text string)) *Form

AddInputField adds an input field to the form.

func (*Form) Draw

func (f *Form) Draw(screen tcell.Screen)

Draw draws the form on the screen.

func (*Form) Focus

func (f *Form) Focus(delegate func(p tview.Primitive))

Focus is called when this primitive receives focus.

func (*Form) HasFocus

func (f *Form) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*Form) InputHandler

func (f *Form) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler returns the handler for this primitive.

func (*Form) SetCancelFunc

func (f *Form) SetCancelFunc(handler func()) *Form

SetCancelFunc sets the function to be called when the form is cancelled.

func (*Form) SetRect

func (f *Form) SetRect(x, y, width, height int)

SetRect sets the position and size of the form.

Jump to

Keyboard shortcuts

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