TextBox is a single-line text editor.
var name = new State<string>("Alex");
new TextBox().Text(name);
You can also pass initial text:
new TextBox("Hello");
TextBox supports undo/redo:
Ctrl+Z: undoCtrl+R: redoSee Undo/Redo.
TextBox can mask its text to behave like a password input:
new TextBox("hunter2")
.IsPassword(true)
.ClipboardMode(TextBoxClipboardMode.Disabled)
.PasswordRevealMode(PasswordRevealMode.WhileFocused);
Masking uses the glyph configured by TextBoxStyle.PasswordMaskGlyph.
When content is wider than the viewport, the TextBox can show start/end indicators configured by TextBoxStyle (arrows/ellipsis variants).
Text: the current text (bindable, supports State<string> two-way binding via fluent API).TextAlignment: left/center/right alignment inside the editor.IsPassword: enables masking.PasswordRevealMode: controls when the real text is revealed.ClipboardMode: enables/disables copy/cut/paste behaviors (useful for secrets).In password mode, copy/cut is typically disabled so the masked value doesn’t leak via clipboard.
HorizontalAlignment = Align.Start, VerticalAlignment = Align.StartTextBox uses background on the text region while keeping borders visually compatible with the terminal background.
See also: