MultiSelectionPrompt<T> Class

Represents a multi selection list prompt.
public sealed class MultiSelectionPrompt<T> : IPrompt<List<T>>, IListPromptStrategy<T> 
    where T : notnull
Namespace
Spectre.Console
Interfaces

Parameters

T
The prompt result type.

Constructors

MultiSelectionPrompt(IEqualityComparer<T>)
Initializes a new instance of the MultiSelectionPrompt<T> class.

Properties

Func<T, string> Converter
Gets or sets the converter to get the display string for a choice. By default the corresponding TypeConverter is used.
Style HighlightStyle
Gets or sets the highlight style of the selected choice.
string InstructionsText
Gets or sets the text that instructs the user of how to select items.
SelectionMode Mode
Gets or sets the selection mode. Defaults to Leaf.
string MoreChoicesText
Gets or sets the text that will be displayed if there are more choices to show.
int PageSize
Gets or sets the page size. Defaults to 10.
bool Required
Gets or sets a value indicating whether or not at least one selection is required.
string Title
Gets or sets the title.

Methods

IMultiSelectionItem<T> AddChoice(T)
Adds a choice.
T GetParent(T)
Returns the parent item of the given item.
IEnumerable<T> GetParents(T)
Returns all parent items of the given item.
List<T> Show(IAnsiConsole)
Shows the prompt.
Task<List<T>> ShowAsync(IAnsiConsole, CancellationToken)
Shows the prompt asynchronously.

Extension Methods

MultiSelectionPrompt<T> AddChoiceGroup<T>(T, IEnumerable<T>)
Adds multiple grouped choices.
MultiSelectionPrompt<T> AddChoiceGroup<T>(T, T[])
Adds multiple grouped choices.
MultiSelectionPrompt<T> AddChoices<T>(IEnumerable<T>)
Adds multiple choices.
MultiSelectionPrompt<T> AddChoices<T>(T, Action<IMultiSelectionItem<T>>)
Adds a choice.
MultiSelectionPrompt<T> AddChoices<T>(T[])
Adds multiple choices.
MultiSelectionPrompt<T> HighlightStyle<T>(Style)
Sets the highlight style of the selected choice.
MultiSelectionPrompt<T> InstructionsText<T>(string)
Sets the text that instructs the user of how to select items.
MultiSelectionPrompt<T> Mode<T>(SelectionMode)
Sets the selection mode.
MultiSelectionPrompt<T> MoreChoicesText<T>(string)
Sets the text that will be displayed if there are more choices to show.
MultiSelectionPrompt<T> NotRequired<T>()
Requires no choice to be selected.
MultiSelectionPrompt<T> PageSize<T>(int)
Sets how many choices that are displayed to the user.
MultiSelectionPrompt<T> Required<T>(bool)
Sets a value indicating whether or not at least one choice must be selected.
MultiSelectionPrompt<T> Required<T>()
Requires a choice to be selected.
MultiSelectionPrompt<T> Select<T>(T)
Marks an item as selected.
MultiSelectionPrompt<T> Title<T>(string)
Sets the title.
MultiSelectionPrompt<T> UseConverter<T>(Func<T, string>)
Sets the function to create a display string for a given choice.