类型 TextareaSnapshot

API 文档由 Go 源码生成,内容为英文。

type TextareaSnapshot struct {
	ID            ui.ID
	Label         string
	Value         string
	DisplayValue  string
	Placeholder   string
	Hint          string
	Disabled      bool
	ReadOnly      bool
	Invalid       bool
	Focused       bool
	NativeEditing bool
	ShowCaret     bool
	// HideEditorText makes the platform editor behind a focused textarea
	// invisible: the component paints the text, selection, composition and caret
	// itself and the editor is only where input arrives (set NativeEditing
	// false, ShowCaret true). A platform editor draws one line, centered in its
	// box, which is right for an input and wrong for a box of several rows, where
	// the caret would sit in the middle instead of on the first line.
	HideEditorText bool
	// NoWrap keeps every line on one row, clipped at the edge of the box, as
	// `white-space: pre` does. The default wraps.
	NoWrap bool
	// InsetBottom keeps that much more of the bottom of the box free of text, for
	// controls the caller lays over it, such as an input group's block-end addon:
	// the rows scroll above them rather than behind.
	InsetBottom float32
	// InsetRight reserves room for caller-owned controls such as a scrollbar.
	InsetRight float32
	// Layout makes the rows the application's to move through: it keeps them from
	// one frame to the next (so a steady paint allocates nothing), scrolls to the
	// caret and, held by the application's key and pointer handlers, moves the
	// caret by visual row (see TextareaLayout). Without it the box wraps and
	// paints from its first row, which suits a box that shows what is in it.
	// With it, DisplayValue must be empty or the text of Value, whose byte
	// offsets Layout reports.
	Layout           *TextareaLayout
	Caret            int
	SelectionStart   int
	SelectionEnd     int
	CompositionStart int
	CompositionEnd   int

}

TextareaSnapshot is a caller-owned multiline editor presentation. Long lines wrap at the width of the box, as in shadcn's textarea, and a newline in DisplayValue starts a row; scrolling follows the caret when Layout is set. Editing and IME state remain owned by the application/runtime.

方法

Semantics#

func (snapshot TextareaSnapshot) Semantics() TextareaSemantics

Semantics returns a normalized, allocation-free semantic snapshot. It does not claim that a platform bridge exposes selection or invalid state yet.