<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/horizontalRadioGroupLayout()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE26horizontalRadioGroupLayoutQryF"
  },
  "title" : "horizontalRadioGroupLayout()"
}
-->

# horizontalRadioGroupLayout()

Sets the style for radio group style pickers within this view to be
horizontally positioned with the radio buttons inside the layout.

```
nonisolated func horizontalRadioGroupLayout() -> some View
```

## Discussion

Use `horizontalRadioGroupLayout()` to configure the visual layout of
radio buttons in a [`Picker`](/documentation/SwiftUI/Picker) so that the radio buttons are arranged
horizontally in the view.

The example below shows two [`Picker`](/documentation/SwiftUI/Picker) controls configured as radio
button groups; the first group shows the default vertical layout; the
second group shows the effect of `horizontalRadioGroupLayout()` which
renders the radio buttons horizontally.

```
struct HorizontalRadioGroupLayout: View {
    @State private var selected = 1
    var body: some View {
        VStack(spacing: 20) {
            Picker(selection: $selected, label: Text("Favorite Color")) {
                Text("Red").tag(1)
                Text("Green").tag(2)
                Text("Blue").tag(3)
                Text("Other").tag(4)
            }
            .pickerStyle(.radioGroup)

            Picker(selection: $selected, label: Text("Favorite Color")) {
                Text("Red").tag(1)
                Text("Green").tag(2)
                Text("Blue").tag(3)
                Text("Other").tag(4)
            }
            .pickerStyle(.radioGroup)
            .horizontalRadioGroupLayout()
        }
        .padding(20)
        .border(Color.gray)
    }
}
```

![A screenshot showing radio button groups laid out horizontally and](images/com.apple.SwiftUI/SwiftUI-view-horizontalRadioGroupLayout@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)