I am working on creating my first app and am struggling to center a New-UDSwitch position inside of a card. Currently I have only been able to center the text box and the save button. The switch itself is always left justified. Hope someone can point me in the right direction.
New-UDCard -Content {
New-UDStack -Content {
New-UDSwitch -Id ‘Automatic IP Rotation’ -Checked $connection.result.ipChangeEnabled -CheckedLabel ‘On’ -UncheckedLabel ‘Off’ -OnChange {
if ($EventData -eq $false) {
# Switch is off
Set-UDElement -Id ‘Automatic IP Rotation Textbox’ -Attributes @{disabled = $true}
Set-UDElement -Id ‘Automatic IP Rotation Textbox’ -Attributes @{value = ‘’}
Set-UDElement -Id ‘SaveButton’ -Attributes @{disabled = $true}
} elseif ($EventData -eq $true) {
# Switch is on
Set-UDElement -Id ‘Automatic IP Rotation Textbox’ -Attributes @{disabled = $false}
Set-UDElement -Id ‘SaveButton’ -Attributes @{disabled = $false}
}
}
New-UDTextbox -Id ‘Automatic IP Rotation Textbox’ -Label ‘Rotation Frequency’ -Value $textboxValue -Disabled:$textboxDisabled
New-UDCardFooter -Content {New-UDButton -Variant ‘outlined’ -Text ‘Save’ -Id ‘SaveButton’ -Disabled:$saveButtonDisabled}
} -Id ‘verticalstack’ -AlignItems ‘center’ -Direction ‘column’
} -Title ‘Automatic IP Rotation’ -Style @{
maxWidth = “300px”;
margin = “0 0”;
}
Product: PowerShell Universal
Version: 5.12