New-UDCheckbox -Label Unchecked
New-UDCheckbox -Label Checked -Checked
New-UDCheckbox -Label 'Filled In' -Checked -FilledIn
New-UDCheckbox -Label 'Disabled' -Checked -FilledIn -Disabled

OnChange Handler

See Event Handler Endpoints for more information about how event handlers work.
To handle changes in the checkbox value, you can add a script block or UDEndpoint to the -OnChange parameter.
New-UDElement -Id "CheckboxState" -Tag "span"
New-UDCheckbox -Id CheckBox -Label "Check me" -OnChange {
$Element = Get-UDElement -Id CheckBox
Set-UDElement -Id "CheckboxState" -Content $Element.Attributes["checked"]

Get the value of the Checkbox

To get checkbox value ($true, $false), you can utilize the Get-UDElement cmdlet to retrieve the bool checked value.
`text New-UDCheckbox -Id MyCheckBox -Label "Check me" $CheckboxValue = ((Get-UDElement -Id "MyCheckBox").Attributes["checked"])
Last modified 3yr ago