Radio is a control that allows the user to only choose one predefined option.
HStack(alignment: .top) {
PBRadio(
items: [
PBRadioItem("Small"),
.init("Small Spacing"),
.init("Small Power")
],
orientation: .vertical,
spacing: Spacing.small,
selected: $selectedSpacing
)
PBRadio(
items: [
PBRadioItem("Medium"),
.init("Medium Spacing"),
.init("Medium Power")
],
orientation: .vertical,
spacing: Spacing.medium,
selected: $selectedSpacing
)
PBRadio(
items: [
PBRadioItem("Large"),
.init("Large Spacing"),
.init("Large Power")
],
orientation: .vertical,
spacing: Spacing.large,
selected: $selectedSpacing
)
}
VStack(alignment: .leading) {
PBRadio(
items: [
PBRadioItem("Small")
],
orientation: .vertical,
padding: Spacing.small,
selected: $selectedPadding
)
PBRadio(
items: [
PBRadioItem("Medium")
],
orientation: .vertical,
padding: Spacing.medium,
selected: $selectedPadding
)
PBRadio(
items: [
PBRadioItem("Large")
],
orientation: .vertical,
padding: Spacing.large,
selected: $selectedPadding
)
}
Name | Type | Description | Default | Values |
---|---|---|---|---|
items | PBRadioItem |
Specifies the value of the Radio buttons | ||
orientation | Orientation |
Changes between stacked or inline Radio items | .vertical |
|
textAlignment | Orientation |
Changes lable position | .horizontal |
|
spacing | CGFloat |
Applies padding around Radio and lable | Spacing.xSmall |
Spacing.none Spacing.xxSmall Spacing.xSmall Spacing.small Spacing.medium Spacing.large Spacing.xLarge |
padding | CGFloat |
Applies padding between Radio and lable | Spacing.xSmall |
Spacing.none Spacing.xxSmall Spacing.xSmall Spacing.small Spacing.medium Spacing.large Spacing.xLarge |
errorState | Bool |
Changes Radio to error styling | ||
selected | PBRadioItem? |
Sets selected Radio item |