<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Menu/init(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4MenuVA2A0C18StyleConfigurationV5LabelVRszAE7ContentVRs_rlEyACyAgIGAEcfc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Creates a menu based on a style configuration.

```
nonisolated init(_ configuration: MenuStyleConfiguration)
```

## Discussion

Use this initializer within the [`makeBody(configuration:)`](/documentation/SwiftUI/MenuStyle/makeBody(configuration:))
method of a [`MenuStyle`](/documentation/SwiftUI/MenuStyle) instance to create an instance of the menu
being styled. This is useful for custom menu styles that modify the
current menu style.

For example, the following code creates a new, custom style that adds a
red border around the current menu style:

```
struct RedBorderMenuStyle: MenuStyle {
    func makeBody(configuration: Configuration) -> some View {
        Menu(configuration)
            .border(Color.red)
    }
}
```

---

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)