input

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package input provides the Input Box component with focus state handling. This component wraps a bubble tea textarea in a bordered container with dynamic border colors based on focus state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() tea.Model

New creates a new InputBox model (for Bubble Tea compatibility).

Types

type InputBox

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

InputBox is a Bubble Tea model that wraps a textarea in a bordered container with focus state handling.

func NewInputBox

func NewInputBox() *InputBox

NewInputBox creates a new InputBox component.

func (*InputBox) BindingKeys

func (m *InputBox) BindingKeys() []key.Binding

BindingKeys returns the key bindings for the InputBox.

func (*InputBox) Blur

func (m *InputBox) Blur()

Blur removes focus from the input.

func (*InputBox) Focus

func (m *InputBox) Focus()

Focus focuses the input.

func (*InputBox) Focused

func (m *InputBox) Focused() bool

Focused returns whether the input is currently focused.

func (*InputBox) GetMode

func (m *InputBox) GetMode() InputMode

GetMode returns the current input mode.

func (*InputBox) GetSize

func (m *InputBox) GetSize() (int, int)

GetSize returns the current dimensions of the InputBox.

func (*InputBox) Init

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

Init initializes the InputBox component.

func (*InputBox) Reset

func (m *InputBox) Reset()

Reset clears the input value.

func (*InputBox) SetMode

func (m *InputBox) SetMode(mode InputMode)

SetMode sets the input mode.

func (*InputBox) SetShowHints

func (m *InputBox) SetShowHints(show bool)

SetShowHints controls whether to show the hints bar.

func (*InputBox) SetSize

func (m *InputBox) SetSize(width, height int)

SetSize sets the dimensions of the InputBox.

func (*InputBox) SetValue

func (m *InputBox) SetValue(value string)

SetValue sets the value of the input.

func (*InputBox) TextArea

func (m *InputBox) TextArea() textarea.Model

TextArea returns the underlying textarea model for external access.

func (*InputBox) Update

func (m *InputBox) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages for the InputBox component.

func (*InputBox) Value

func (m *InputBox) Value() string

Value returns the current value of the input.

func (*InputBox) View

func (m *InputBox) View() string

View renders the InputBox component.

type InputBoxKeyMaps

type InputBoxKeyMaps struct {
	Send      key.Binding
	Multiline key.Binding
	Clear     key.Binding
	Escape    key.Binding
}

InputBoxKeyMaps defines key bindings for the InputBox.

func DefaultInputBoxKeyMaps

func DefaultInputBoxKeyMaps() InputBoxKeyMaps

DefaultInputBoxKeyMaps returns the default key bindings.

type InputMode

type InputMode string

InputMode represents the current editing mode.

const (
	ModeInsert  InputMode = "INSERT"
	ModeVisual  InputMode = "VISUAL"
	ModeCommand InputMode = "COMMAND"
	ModeSearch  InputMode = "SEARCH"
	ModeNormal  InputMode = "NORMAL"
)

func (InputMode) String

func (m InputMode) String() string

String returns the string representation of the InputMode.

Jump to

Keyboard shortcuts

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