Skip to content
ConsoleMonster
Class

Field

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
abstract
Attributes
Fluent

A form field: a name (the key in FormValues), a label, help, a default, validation, a condition for showing it, the fields it depends on, and the command-line parameter it maps to for the equivalent command.

Inheritance

  • object
  • Field

Derived Types

Usage

Explore 7 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.

Returned or exposed by 3

Accepted by parameters 4

Methods

public virtual string Display(object? value, PromptLabels labels) #

The value as shown in the form and on the review page.

Parameters

value object? required
The value.
labels ConsoleMonster.Interactive.PromptLabels required
The labels.

Returns

string The text.
public override string ToString() #

Returns a string that represents the current object.

Returns

string A string that represents the current object.

Properties

public string Key { get; } #

The key in the form values.

public string Label { get; set; } #

The label.

public string? Help { get; set; } #

Help shown while the field has focus.

public string? ParameterName { get; set; } #

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

public bool Required { get; set; } #

Whether an empty value is refused.

public object? Default { get; set; } #

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

public object? Value { get; set; } #

The current value.

public Func<FormValues, bool>? VisibleWhen { get; set; } #
Fluent("ShowWhen")

Shows the field only while this returns true.

public IList<string> DependsOn { get; } #

Fields whose change resets this field (and reloads its options).

public Func<object?, FormValues, string?>? Validator { get; set; } #
Fluent("Validate")

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

public bool Remember { get; set; } #

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

public abstract FieldKind Kind { get; } #

The kind.