A single-line text input widget that accepts keyboard input when focused. More...
Public Member Functions | |
| void | OnKeyEvent (KeyMsg key, Action< IMsg > dispatch) |
| Handle printable char input, Backspace, and Left/Right cursor movement. | |
| void | Render (IRenderContext ctx) |
| Render this widget into the provided context.The context carries the allocated region, theme, and color profile. Implementations MUST NOT write outside ctx.Region. | |
| TextInput () | |
| Object-initializer constructor; all properties default. | |
| TextInput (string value="", string placeholder="", int cursorPosition=0, Style? style=null) | |
| Positional constructor for inline usage. | |
Properties | |
| int | CursorPosition [get] |
| Zero-based index of the cursor within Value. | |
| bool | HasFocus [get, set] |
| True when this widget holds keyboard focus. | |
| SizeConstraint | Height = SizeConstraint.Fixed(1) [get] |
| Height constraint used by the layout engine. | |
| string | Placeholder = "" [get] |
| Placeholder text shown when Value is empty. | |
| Style | Style = Style.Default [get] |
| Visual style for the input text. Inherits theme base style when no properties are set. | |
| string | Value = "" [get] |
| Current text value in the input field. | |
| SizeConstraint | Width = SizeConstraint.Flex(1) [get] |
| Width constraint used by the layout engine. | |
A single-line text input widget that accepts keyboard input when focused.
| ConsoleForge.Widgets.TextInput.TextInput | ( | string | value = "", |
| string | placeholder = "", | ||
| int | cursorPosition = 0, | ||
| Style? | style = null ) |
Positional constructor for inline usage.
| value | Initial text value. |
| placeholder | Placeholder shown when value is empty. |
| cursorPosition | Initial cursor position (clamped to value length). |
| style | Optional visual style override. |
| void ConsoleForge.Widgets.TextInput.OnKeyEvent | ( | KeyMsg | key, |
| Action< IMsg > | dispatch ) |
Handle printable char input, Backspace, and Left/Right cursor movement.
NOTE: TextInput is immutable — this method mutates state via HasFocus but keyboard changes are returned as a model message. Callers must update the model's reference to this widget.
Implements ConsoleForge.Layout.IFocusable.