input

package
v1.168.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package input provides Bubbles text inputs with independently blinking cursors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Expose

func Expose(previous, current Cursor) tea.Cmd

Expose starts a fresh cycle when an input becomes visible, and retires the old cycle without disturbing local focus, selection, or text.

Types

type Area

type Area struct {
	textarea.Model
	// contains filtered or unexported fields
}

Area is a multi-line text input with the same blink behavior as Text.

func NewArea

func NewArea() Area

NewArea creates a multi-line input with the default Bubbles styling.

func (*Area) CursorDown

func (m *Area) CursorDown()

func (*Area) CursorUp

func (m *Area) CursorUp()

func (*Area) InsertString

func (m *Area) InsertString(value string)

func (*Area) MoveToBegin

func (m *Area) MoveToBegin()

func (*Area) MoveToEnd

func (m *Area) MoveToEnd()

func (*Area) OnCursorChange

func (m *Area) OnCursorChange(fn func())

OnCursorChange lets a cached parent invalidate its rendering.

func (*Area) Reset

func (m *Area) Reset()

func (*Area) SetCursorColumn

func (m *Area) SetCursorColumn(col int)

func (*Area) SetStyles

func (m *Area) SetStyles(style textarea.Styles)

func (*Area) SetValue

func (m *Area) SetValue(value string)

func (*Area) Update

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

func (*Area) WakeCursor

func (m *Area) WakeCursor()

WakeCursor refreshes the caret when the owner handles input outside Update.

type BlinkMsg

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

BlinkMsg is an addressed cursor timer event. Only the input that scheduled it may apply it, and only while that input is still exposed.

func (*BlinkMsg) Apply

func (m *BlinkMsg) Apply(active Cursor) tea.Cmd

Apply advances the cursor if this is still its current timer event.

type Cursor

type Cursor interface {
	Focused() bool
	VirtualCursor() bool
	SetVirtualCursor(enabled bool)
	// contains filtered or unexported methods
}

Cursor is the visibility surface of an input. The parent chooses which focused input is exposed; the input controls the blink phase and timing.

func CursorOf

func CursorOf(component any) Cursor

CursorOf gets the input of a component that may not contain text inputs.

type CursorOwner

type CursorOwner interface {
	CursorInput() Cursor
}

CursorOwner exposes the focused input of a component, if it has one.

type Text

type Text struct {
	textinput.Model
	// contains filtered or unexported fields
}

Text is a single-line text input. Bubbles handles editing and draws the virtual cursor, but its own blink mode is kept off: moving the cursor must not cancel or replace the independently scheduled timer event.

func NewText

func NewText() Text

NewText creates a single-line input with the default Bubbles styling.

func (*Text) CursorEnd

func (m *Text) CursorEnd()

func (*Text) OnCursorChange

func (m *Text) OnCursorChange(fn func())

OnCursorChange lets a cached parent invalidate its rendering.

func (*Text) SetStyles

func (m *Text) SetStyles(style textinput.Styles)

func (*Text) SetValue

func (m *Text) SetValue(value string)

func (*Text) Update

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

Jump to

Keyboard shortcuts

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