FormTextFieldWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A form text field widget that renders as a label + text input + error indicator. Also serves as a field handle for cross-field references (validation, enablement).
public sealed record FormTextFieldWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<FormTextFieldWidget>Inheritance
Object → Hex1bWidget → FormTextFieldWidget
Implements
Constructors
FormTextFieldWidget(string, string)
Parameters:
public FormTextFieldWidget(string fieldId, string label)Properties
FieldId
Unique identifier for this field within the form. Preserved across fluent method calls.
Returns: String
public string FieldId { get; }Label
The label text displayed for this field.
Returns: String
public string Label { get; init; }Methods
Adornment(Func<string, CancellationToken, Task<bool>>, Func<Hex1bWidget>)
Adds an adornment with an async predicate and widget builder. The adornment is displayed next to the field when the predicate resolves to true. When the field value changes, the predicate is re-evaluated (cancelling any in-flight evaluation).
Parameters:
predicate(Func<String, CancellationToken, Boolean>>): Async function receiving (fieldValue, cancellationToken) → bool.builder(Func<Hex1bWidget>): Factory returning the widget to display when the predicate is true.
Returns: FormTextFieldWidget
public FormTextFieldWidget Adornment(Func<string, CancellationToken, Task<bool>> predicate, Func<Hex1bWidget> builder)Adornment(Func<string, Task<bool>>, Func<Hex1bWidget>)
Adds an adornment with an async predicate (no cancellation token) and widget builder.
Parameters:
predicate(Func<String, Boolean>>):builder(Func<Hex1bWidget>):
Returns: FormTextFieldWidget
public FormTextFieldWidget Adornment(Func<string, Task<bool>> predicate, Func<Hex1bWidget> builder)EnableWhen(Func<bool>)
Enables this field only when the predicate returns true.
Parameters:
predicate(Func<Boolean>):
Returns: FormTextFieldWidget
public FormTextFieldWidget EnableWhen(Func<bool> predicate)EnableWhenValid(params FormTextFieldWidget[])
Enables this field only when all specified fields are valid.
Parameters:
fields(FormTextFieldWidget[]):
Returns: FormTextFieldWidget
public FormTextFieldWidget EnableWhenValid(params FormTextFieldWidget[] fields)Height(int)
Sets the height of the text input in lines.
Parameters:
lines(Int32):
Returns: FormTextFieldWidget
public FormTextFieldWidget Height(int lines)InitialValue(string)
Sets the initial text value.
Parameters:
value(String):
Returns: FormTextFieldWidget
public FormTextFieldWidget InitialValue(string value)LabelPlacement(LabelPlacement)
Overrides the label placement for this specific field.
Parameters:
placement(LabelPlacement):
Returns: FormTextFieldWidget
public FormTextFieldWidget LabelPlacement(LabelPlacement placement)MaxWidth(int)
Sets the maximum width of the text input.
Parameters:
width(Int32):
Returns: FormTextFieldWidget
public FormTextFieldWidget MaxWidth(int width)MinWidth(int)
Sets the minimum width of the text input.
Parameters:
width(Int32):
Returns: FormTextFieldWidget
public FormTextFieldWidget MinWidth(int width)Multiline()
Enables multi-line text editing for this form field.
Returns: FormTextFieldWidget
public FormTextFieldWidget Multiline()Multiline(int)
Enables multi-line text editing with a maximum number of lines. Once the limit is reached, no more newlines can be inserted.
Parameters:
maxLines(Int32):
Returns: FormTextFieldWidget
public FormTextFieldWidget Multiline(int maxLines)OnTextChanged(Action<TextChangedEventArgs>)
Sets a handler for text change events.
Parameters:
handler(Action<TextChangedEventArgs>):
Returns: FormTextFieldWidget
public FormTextFieldWidget OnTextChanged(Action<TextChangedEventArgs> handler)OnTextChanged(Func<TextChangedEventArgs, Task>)
Sets an async handler for text change events.
Parameters:
handler(Func<TextChangedEventArgs, Task>):
Returns: FormTextFieldWidget
public FormTextFieldWidget OnTextChanged(Func<TextChangedEventArgs, Task> handler)Validate(Func<string, ValidationResult>)
Adds a validator to this field.
Parameters:
validator(Func<String, ValidationResult>):
Returns: FormTextFieldWidget
public FormTextFieldWidget Validate(Func<string, ValidationResult> validator)ValidateOn(ValidateOn)
Sets when validation should be triggered for this field.
Parameters:
mode(ValidateOn):
Returns: FormTextFieldWidget
public FormTextFieldWidget ValidateOn(ValidateOn mode)Width(int)
Sets an exact fixed width for the text input (sets both MinWidth and MaxWidth).
Parameters:
width(Int32):
Returns: FormTextFieldWidget
public FormTextFieldWidget Width(int width)WordWrap()
Enables word wrapping for this multi-line form field.
Returns: FormTextFieldWidget
public FormTextFieldWidget WordWrap()Remarks
FormTextFieldWidget is created via form.TextField("Label") inside a Form builder. It composes a label (TextBlockWidget), a text input (TextBoxWidget), and an optional error indicator into a single self-contained field.
The widget also acts as a field handle: the uniquely identifies this field within the form, enabling cross-field features like .