Skip to content
ConsoleMonster

API Reference

Class

ChoiceField

Namespace ConsoleMonster.Interactive
Assembly ConsoleMonster
Base Field
Modifiers sealed

One or several values from a list, given up front or loaded asynchronously from the values of the fields it depends on (choosing a site loads its servers): a spinner shows while loading, and loading can be cancelled.

Inheritance

Usage

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

Constructors

public ChoiceField(String name, String? label = null, Boolean multiple = false) #

Creates a choice field.

Parameters

name System.String requiredposition: 0
The key.
label System.String? = null optionalposition: 1
The label.
multiple System.Boolean = false optionalposition: 2
Whether several values can be chosen.

Methods

public override String Display(Object? value, PromptLabels labels) #
Returns: String

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

Parameters

value System.Object? requiredposition: 0
The value.
labels ConsoleMonster.Interactive.PromptLabels requiredposition: 1
The labels.

Returns

The text.

Properties

public override FieldKind Kind { get; } #

The kind.

public Boolean Multiple { get; } #

Whether several values can be chosen.

public IList<Choice> Choices { get; } #

The choices (replaced by the loader's result when one is set).

public Func<FormValues, CancellationToken, Task<IEnumerable<Choice>>>? Loader { get; set; } #

Loads the choices from the current values (dependent fields).

public Int32? Minimum { get; set; } #

The fewest values (multiple).

public Int32? Maximum { get; set; } #

The most values (multiple).

public Func<Choice, IWidget?>? Preview { get; set; } #

Preview content for the focused choice in the editor.