Skip to content
ConsoleMonster
Class

SelectPrompt<T>

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

Pick one value from a list: type to filter (fuzzy, matches highlighted), groups, hotkeys, descriptions, badges, disabled choices with their reason, paging and an optional preview pane. Returns the value itself (any object).

Inheritance

Usage

Explore 18 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 9

Type Parameters

T
The value type.

Constructors

SelectPrompt 2 overloads
public SelectPrompt<T>(string title, IEnumerable<T?> values, Func<T?, string>? display = null, Func<T?, string?>? group = null) #

Creates a selection from values.

Parameters

title string required
The question.
values System.Collections.Generic.IEnumerable<T?> required
The values.
display System.Func<T?, string>? = null optional
The title of a value; null uses its text.
group System.Func<T?, string?>? = null optional
The group of a value; null for none.
public SelectPrompt<T>(string title, IEnumerable<Choice> choices) #

Creates a selection from prepared choices (their values must be T).

Parameters

title string required
The question.
choices System.Collections.Generic.IEnumerable<ConsoleMonster.Interactive.Choice> required
The choices.

Methods

public override string Describe(T? value) #

The answer as text, for the summary line left in the scrollback.

Parameters

value T? required
The answer.

Returns

string The text.

Properties

public IList<Choice> Choices { get; } #

The choices, in display order.

public Func<T?, IWidget?>? Preview { get; set; } #
Fluent("PreviewBy")

Preview content for the focused value.

public Func<T?, string?>? PreviewText { get; set; } #
Fluent("PreviewTextBy")

Preview text for the focused value (wrapped in the preview pane).

public int PageSize { get; set; } #

The preferred number of visible rows.