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

# webViewContextMenu(menu:)

Adds an item-based context menu to a WebView, replacing the default set of context menu items.

```
nonisolated func webViewContextMenu(@ViewBuilder menu: @escaping @MainActor @Sendable (WebView.ActivatedElementInfo) -> some View) -> some View
```

## Parameters

`menu`

A closure that produces the menu. The single parameter to the closure describes the type of webpage element that was acted upon.

## Return Value

A view that can display an item-based context menu.

---

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)