Radio
Radio component for Universal Dashboard
Radio buttons allow the user to select one option from a set.
Use radio buttons when the user needs to see all available options. If available options can be collapsed, consider using a dropdown menu because it uses less space.
Radio buttons should have the most commonly used option selected by default.

Simple Radio

1
New-UDRadioGroup -Label "Day" -Content {
2
New-UDRadio -Label Monday -Value 'monday'
3
New-UDRadio -Label Tuesday -Value 'tuesday'
4
New-UDRadio -Label Wednesday -Value 'wednesday'
5
New-UDRadio -Label Thursday -Value 'thursday'
6
New-UDRadio -Label Friday -Value 'friday'
7
New-UDRadio -Label Saturday -Value 'saturday'
8
New-UDRadio -Label Sunday -Value 'sunday'
9
}
Copied!

OnChange

An event handler that is called when the radio group is changed. the $Body variable will contain the current value.
1
New-UDRadioGroup -Label "Day" -Content {
2
New-UDRadio -Label Monday -Value 'monday'
3
New-UDRadio -Label Tuesday -Value 'tuesday'
4
New-UDRadio -Label Wednesday -Value 'wednesday'
5
New-UDRadio -Label Thursday -Value 'thursday'
6
New-UDRadio -Label Friday -Value 'friday'
7
New-UDRadio -Label Saturday -Value 'saturday'
8
New-UDRadio -Label Sunday -Value 'sunday'
9
} -OnChange { Show-UDToast -Message $Body }
10
}
Copied!

Default Value

Set the default value of the radio group.
1
New-UDRadioGroup -Label "Day" -Content {
2
New-UDRadio -Label Monday -Value 'monday'
3
New-UDRadio -Label Tuesday -Value 'tuesday'
4
New-UDRadio -Label Wednesday -Value 'wednesday'
5
New-UDRadio -Label Thursday -Value 'thursday'
6
New-UDRadio -Label Friday -Value 'friday'
7
New-UDRadio -Label Saturday -Value 'saturday'
8
New-UDRadio -Label Sunday -Value 'sunday'
9
} -Value 'sunday'
Copied!

Custom Formatting

You can use custom formatting within the radio group. The below example will place the radio buttons next to each other instead of on top of each other.
1
New-UDRadioGroup -Label "Day" -Content {
2
New-UDRow -Columns {
3
New-UDColumn -LargeSize 1 -Content {
4
New-UDRadio -Label Monday -Value 'monday'
5
}
6
New-UDColumn -LargeSize 1 -Content {
7
New-UDRadio -Label Sunday -Value 'sunday'
8
}
9
}
10
}
Copied!
New-UDRadio
Name
Type
Description
Required
Id
String
The ID of the component. It defaults to a random GUID.
false
Label
String
The label to show next to the radio.
false
Disabled
SwitchParameter
Whether the radio is disabled.
false
Value
String
The value of the radio.
false
LabelPlacement
String
The position to place the label in relation to the radio.
false
Last modified 6mo ago