Skip to content
ConsoleMonster
Class

TextField

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Base
Field
Modifiers
sealed

A line of text.

Inheritance

Usage

Explore 62 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 30

Constructors

public TextField(string key, string? label = null) #

Creates a text field.

Parameters

key string required
The key.
label string? = null optional
The label.

Properties

public override FieldKind Kind { get; } #

The kind.

public string? Placeholder { get; set; } #

Muted text while empty.

public int MinLength { get; set; } #

The fewest characters.

public int MaxLength { get; set; } #

The most characters.

public string? Pattern { get; set; } #

A pattern the whole value must match.

public string? PatternMessage { get; set; } #

The message when the pattern does not match.

Extension Methods

public static TextField Default(TextField textField, object? value) #

Sets Field.Default: The declared default: the starting value until a value is set, and values equal to it are left out of the equivalent command.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value object? required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.Default = value;       textField.Default(value);
DependsOn 2 overloads
public static TextField DependsOn(TextField textField, string item) #

Adds an item to Field.DependsOn: Fields whose change resets this field (and reloads its options).

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
item string required
The item.

Returns

TextField The same instance.
public static TextField DependsOn(TextField textField, IEnumerable<string> items) #

Adds items to Field.DependsOn: Fields whose change resets this field (and reloads its options).

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
items System.Collections.Generic.IEnumerable<string> required
The items, in order.

Returns

TextField The same instance.
public static TextField Help(TextField textField, string? value) #

Sets Field.Help: Help shown while the field has focus.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value string? required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.Help = value;          textField.Help(value);
public static TextField Label(TextField textField, string value) #

Sets Field.Label: The label.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value string required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.Label = value;         textField.Label(value);
public static TextField MaxLength(TextField textField, int value) #

Sets TextField.MaxLength: The most characters.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value int required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.MaxLength = value;     textField.MaxLength(value);
public static TextField MinLength(TextField textField, int value) #

Sets TextField.MinLength: The fewest characters.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value int required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.MinLength = value;     textField.MinLength(value);
public static TextField ParameterName(TextField textField, string? value) #

Sets Field.ParameterName: The command-line parameter this field supplies (Domain, -Domain, --domain); null leaves the field out of the equivalent command.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value string? required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property       // C# fluent
textField.ParameterName = value;    textField.ParameterName(value);
public static TextField Pattern(TextField textField, string? value) #

Sets TextField.Pattern: A pattern the whole value must match.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value string? required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.Pattern = value;       textField.Pattern(value);
public static TextField PatternMessage(TextField textField, string? value) #

Sets TextField.PatternMessage: The message when the pattern does not match.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value string? required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property        // C# fluent
textField.PatternMessage = value;    textField.PatternMessage(value);
public static TextField Placeholder(TextField textField, string? value) #

Sets TextField.Placeholder: Muted text while empty.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value string? required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property     // C# fluent
textField.Placeholder = value;    textField.Placeholder(value);
public static TextField Remember(TextField textField, bool value = true) #

Sets Field.Remember: Whether the value is kept in presets and remembered choices (never for secrets).

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.Remember = value;      textField.Remember(value);
public static TextField Required(TextField textField, bool value = true) #

Sets Field.Required: Whether an empty value is refused.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.Required = value;      textField.Required(value);
public static TextField ShowWhen(TextField textField, Func<FormValues, bool>? value) #

Sets Field.VisibleWhen: Shows the field only while this returns true.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value System.Func<ConsoleMonster.Interactive.FormValues, bool>? required
The callback.

Returns

TextField The same instance.

Examples

// C# initializer or property     // C# fluent
textField.VisibleWhen = value;    textField.ShowWhen(value);
public static TextField Validate(TextField textField, Func<object?, FormValues, string?>? value) #

Sets Field.Validator: A validator: returns an error message, or null when the value is fine.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value System.Func<object?, ConsoleMonster.Interactive.FormValues, string?>? required
The callback.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.Validator = value;     textField.Validate(value);
public static TextField Value(TextField textField, object? value) #

Sets Field.Value: The current value.

Parameters

textField ConsoleMonster.Interactive.TextField required
The instance.
value object? required
The value.

Returns

TextField The same instance.

Examples

// C# initializer or property    // C# fluent
textField.Value = value;         textField.Value(value);