Skip to content

Read-SpectreMultiSelectionGrouped

Synopsis

Displays a multi-selection prompt with grouped choices and returns the selected choices.


Description

Displays a multi-selection prompt with grouped choices and returns the selected choices. The prompt allows the user to select one or more choices from a list of options. The choices can be grouped into categories, and the user can select choices from each category.


Examples

This example displays a multi-selection prompt with two groups of choices: “Primary Colors” and “Secondary Colors”. The prompt uses the “Name” property of each choice as the label. The user can select one or more choices from each group.

Read-SpectreMultiSelectionGrouped -Title "Select your favorite colors" -Choices @(
    @{
        Name = "Primary Colors"
        Choices = @("Red", "Blue", "Yellow")
    },
    @{
        Name = "Secondary Colors"
        Choices = @("Green", "Orange", "Purple")
    }
)

Parameters

Title

The title of the prompt. The default value is “What are your favourite [color]?“.

TypeRequiredPositionPipelineInput
[String]false1false

Choices

An array of choice groups. Each group is a hashtable with two keys: “Name” and “Choices”. The “Name” key is a string that represents the name of the group, and the “Choices” key is an array of strings that represents the choices in the group.

TypeRequiredPositionPipelineInput
[Array]false2false

ChoiceLabelProperty

The name of the property to use as the label for each choice. If this parameter is not specified, the choices are displayed as strings.

TypeRequiredPositionPipelineInput
[String]false3false

Color

The color of the selected choices. The default value is the accent color of the script.

TypeRequiredPositionPipelineInput
[String]false4false

PageSize

The number of choices to display per page. The default value is 10.

TypeRequiredPositionPipelineInput
[Int32]false5false

AllowEmpty

TypeRequiredPositionPipelineInput
[Switch]falsenamedfalse

Syntax

Read-SpectreMultiSelectionGrouped [[-Title] <String>] [[-Choices] <Array>] [[-ChoiceLabelProperty] <String>] [[-Color] <String>] [[-PageSize] <Int32>] [-AllowEmpty] [<CommonParameters>]