> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/powershell-commands/new-udselect.md).

# New-UDSelect

### Synopsis

Creates a new select.

### Syntax

```powershell
New-UDSelect [[-Id] <String>] [[-Option] <ScriptBlock>] [[-Label] <String>] [[-OnChange] <Endpoint>] [[-DefaultValue] <Object>] [-Disabled] [-Multiple] [[-MaxWidth] <String>] [[-ClassName] <String>] [-FullWidth] [[-OnEnter] <Endpoint>] [[-Variant] <String>] [[-Icon] <Object>] [[-Sx] <Hashtable>] [-Checkbox] [<CommonParameters>]
```

### Description

Creates a new select. Selects can have multiple options and option groups. Selects can also be multi-select.

### Parameters

#### -Id

The ID of the component. It defaults to a random GUID.

```
Required?                    false
Position?                    1
Default value                ([Guid]::NewGuid())
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Option

Options to include in this select. This can be either New-UDSelectOption or New-UDSelectGroup.

```
Required?                    false
Position?                    2
Default value                {
                    New-UDSelectOption -Name 'Option 1' -Value 1
                    New-UDSelectOption -Name 'Option 2' -Value 2
                }
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -Label

The label to show with the select.

```
Required?                    false
Position?                    3
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -OnChange

A script block that is executed when the script changes. $EventData will be an array of the selected values.

```
Required?                    false
Position?                    4
Default value
Accept pipeline input?       false
Aliases
Accept wildcard characters?  false
```

#### -DefaultValue The default selected value.Required?                    falsePosition?                    5Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false    -Disabled \[\<SwitchParameter>]        Whether this select is disabled.Required?                    falsePosition?                    namedDefault value                FalseAccept pipeline input?       falseAliasesAccept wildcard characters?  false    -Multiple \[\<SwitchParameter>]        Whether you can select multiple values.Required?                    falsePosition?                    namedDefault value                FalseAccept pipeline input?       falseAliasesAccept wildcard characters?  false-MaxWidthThe maximum width of the select.Required?                    falsePosition?                    6Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false-ClassNameA CSS class to apply to the select.Required?                    falsePosition?                    7Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false    -FullWidth \[\<SwitchParameter>]        Stretch the select to the full width of the parent component.Required?                    falsePosition?                    namedDefault value                FalseAccept pipeline input?       falseAliasesAccept wildcard characters?  false-OnEnterA script block that is called when the user presses the enter key. The $EventData variable will contain the current value of the textbox.Required?                    falsePosition?                    8Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false-VariantThe variant of the select. Can be filled, outlined, or standard.Required?                    falsePosition?                    9Default value                standardAccept pipeline input?       falseAliasesAccept wildcard characters?  false-Icon The icon to show next to the textbox. Use New-UDIcon to create an icon.Required?                    falsePosition?                    10Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false-SxA hashtable of styles to apply to the select.Required?                    falsePosition?                    11Default valueAccept pipeline input?       falseAliasesAccept wildcard characters?  false    -Checkbox \[\<SwitchParameter>]        Whether to display checkboxes when using multiselect.Required?                    falsePosition?                    namedDefault value                FalseAccept pipeline input?       falseAliasesAccept wildcard characters?  false    \<CommonParameters>        This cmdlet supports the common parameters: Verbose, Debug,        ErrorAction, ErrorVariable, WarningAction, WarningVariable,        OutBuffer, PipelineVariable, and OutVariable. For more information, see        about\_CommonParameters (<https://go.microsoft.com/fwlink/?LinkID=113216).Outputs--------------------------> EXAMPLE 1 --------------------------PS >New-UDSelect -Label 'Select' -Id 'select1' -Option {PS >    New-UDSelectOption -Name "One" -Value 1PS >    New-UDSelectOption -Name "Two" -Value 2PS >    New-UDSelectOption -Name "Three" -Value 3PS > } -FullWidthBasic Select|A basic select with three options-------------------------- EXAMPLE 2 --------------------------PS >New-UDSelect -Label 'Select' -Id 'select2' -Option {PS >    New-UDSelectOption -Name "One" -Value 1PS >    New-UDSelectOption -Name "Two" -Value 2PS >    New-UDSelectOption -Name "Three" -Value 3PS > } -DefaultValue 2 -OnChange {PS >    Show-UDToast -Message $EventDataPS > } -FullWidthOnChange|A select with an OnChange script block that shows a toast when the value changes.-------------------------- EXAMPLE 3 --------------------------PS >New-UDSelect -Label 'Select' -Id 'select3' -Option {PS >    New-UDSelectOption -Name "One" -Value 1PS >    New-UDSelectOption -Name "Two" -Value 2PS >    New-UDSelectOption -Name "Three" -Value 3PS > } -Disabled -FullWidthDisabled|A disabled select.-------------------------- EXAMPLE 4 --------------------------PS >New-UDSelect -Label 'Select' -Id 'select4' -Option {PS >    New-UDSelectOption -Name "One" -Value 1PS >    New-UDSelectOption -Name "Two" -Value 2PS >    New-UDSelectOption -Name "Three" -Value 3PS > } -Multiple -FullWidthMultiple|A select that allows multiple selections.-------------------------- EXAMPLE 5 --------------------------PS >New-UDSelect -Label 'Select' -Id 'select4' -Option {PS >    New-UDSelectOption -Name "One" -Value 1PS >    New-UDSelectOption -Name "Two" -Value 2PS >    New-UDSelectOption -Name "Three" -Value 3PS > } -Multiple -FullWidth -CheckboxMultiple with Checkboxes|A select that allows multiple selections with checkboxes.-------------------------- EXAMPLE 6 --------------------------PS >New-UDSelect -Label 'Select' -Id 'select5' -Option {PS >    New-UDSelectOption -Name "One" -Value 1PS >    New-UDSelectOption -Name "Two" -Value 2PS >    New-UDSelectOption -Name "Three" -Value 3PS > } -Variant outlined -FullWidthOutlined|A select with an outlined variant.-------------------------- EXAMPLE 7 --------------------------PS >New-UDSelect -Label 'Select' -Id 'select6' -Option {PS >    New-UDSelectOption -Name "One" -Value 1PS >    New-UDSelectOption -Name "Two" -Value 2PS >    New-UDSelectOption -Name "Three" -Value 3PS > } -FullWidth -Icon (New-UDIcon -Icon Home)Icon|A select with an icon.-------------------------- EXAMPLE 8 --------------------------PS >New-UDSelect -Label 'Select' -Id 'select7' -Option {PS >    New-UDSelectGroup -Name "Category 1" -Option {PS >        New-UDSelectOption -Name "One" -Value 1PS >        New-UDSelectOption -Name "Two" -Value 2PS >    }PS >    New-UDSelectGroup -Name "Category 2" -Option {PS >        New-UDSelectOption -Name "Three" -Value 3PS >        New-UDSelectOption -Name "Four" -Value 4PS >    }PS > } -FullWidthGrouped|A select with option groups.\[Component("Select", "ListDropdown", "Creates a new card.")]


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.devolutions.net/powershell-universal/powershell-commands/new-udselect.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
