<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/widgetURL(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewP9WidgetKitE9widgetURLyQr10Foundation0G0VSgF"
  },
  "title" : "widgetURL(_:)"
}
-->

# widgetURL(_:)

Sets the URL to open in the containing app when the user clicks the widget.

```
@MainActor @preconcurrency func widgetURL(_ url: URL?) -> some View
```

## Parameters

`url`

The URL to open in the containing app.

## Return Value

A view that opens the specified URL when the user clicks
the widget.

## Discussion

Widgets support one `widgetURL` modifier in their view hierarchy.
If multiple views have `widgetURL` modifiers, the behavior is
undefined.

---

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)