New-UDSelect
Synopsis
Creates a new select.
Syntax
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] [[-Aria] <ScriptBlock>] [<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.
-Label
The label to show with the select.
-OnChange
A script block that is executed when the script changes. $EventData will be an array of the selected values.
-DefaultValue
The default selected value.
-Disabled
Whether this select is disabled.
-Multiple
Whether you can select multiple values.
-MaxWidth
The maximum width of the select.
-ClassName
A CSS class to apply to the select.
-FullWidth
Stretch the select to the full width of the parent component.
-OnEnter
A script block that is called when the user presses the enter key. The $EventData variable will contain the current value of the textbox.
-Variant
The variant of the select. Can be filled, outlined, or standard.
-Icon
The icon to show next to the textbox. Use New-UDIcon to create an icon.
-Sx
A hashtable of styles to apply to the select.
-Checkbox
Whether to display checkboxes when using multiselect.
-Aria
A script block of New-UDAriaAttribute calls that supplies ARIA or role attributes for the select control.
Common parameters
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters.
Outputs
Examples
Example 1: Basic Select
A basic select with three options
Example 2: OnChange
A select with an OnChange script block that shows a toast when the value changes.
Example 3: Disabled
A disabled select.
Example 4: Multiple
A select that allows multiple selections.
Example 5: Multiple with Checkboxes
A select that allows multiple selections with checkboxes.
Example 6: Outlined
A select with an outlined variant.
Example 7: Icon
A select with an icon.
Example 8: Grouped
A select with option groups.
[Component("Select", "ListDropdown", "Creates a new card.")]
Last updated
Was this helpful?