API Reference
Choice
One option in a selection prompt, menu or choice field: the value returned when it is chosen, the title shown, and optional group, description, hotkey, badge, disabled reason and initial selection.
Inheritance
- Object
- Choice
Usage
Explore 16 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 9
- Method Choice.From``1
- Property ChoiceField.Choices
- Property ChoiceField.Loader
- Property ChoiceField.Preview
- Property MenuItem.Choices
- Property MenuItem.ChoicesLoader
- Property MenuItem.Preview
- Property MultiSelectPrompt.Choices
- Property SelectPrompt.Choices
Accepted by parameters 7
- Method Form.MultiSelect
- Method Form.Select
- Method FormPage.MultiSelect
- Method FormPage.Select
- Method MenuItem.LoadChoices
- Constructor MultiSelectPrompt.MultiSelectPrompt
- Constructor SelectPrompt.SelectPrompt
Constructors
public Choice(Object? value, String? title = null) #Creates a choice.
Parameters
- value System.Object?
- The value returned when chosen (any object).
- title System.String? = null
- The title shown; null uses the value's text.
Methods
public static List<Choice> From<T>(IEnumerable<T?> values, Func<T?, String>? title = null, Func<T?, String?>? group = null) #List<Choice>Builds choices from values with a title selector.
Type Parameters
- T
- The value type.
Parameters
- values System.Collections.Generic.IEnumerable<T?>
- The values.
- title System.Func<T?, System.String>? = null
- The title for a value; null uses its text.
- group System.Func<T?, System.String?>? = null
- The group for a value, or null.
Returns
The choices.
public override String ToString() #StringReturns a string that represents the current object.
Returns
A string that represents the current object.
Inherited Methods
Properties
public RichText? RichTitle { get; set; } #A styled title shown instead of Choice.Title while no filter is active.
public String? Description { get; set; } #A sentence shown under the list while the choice has focus.
public Char? Hotkey { get; set; } #A key that picks the choice directly (letters and digits).
public RichText? Badge { get; set; } #Short right-aligned text: a count, a state, a tag ("new", "24 tasks").
public String? DisabledReason { get; set; } #Why the choice cannot be picked; null when it can. Disabled choices are dimmed and show the reason on focus.
public Boolean Selected { get; set; } #Whether a multi-selection starts with this choice selected.
public IWidget? Preview { get; set; } #Content for the preview pane while the choice has focus (overrides the prompt's preview function).