<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/TabContent/popover(isPresented:attachmentAnchor:arrowEdge:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10TabContentPAAE7popover11isPresented16attachmentAnchor9arrowEdge7contentQrAA7BindingVySbG_AA017PopoverAttachmentI0OAA0K0OSgqd__yctAA4ViewRd__lF"
  },
  "title" : "popover(isPresented:attachmentAnchor:arrowEdge:content:)"
}
-->

# popover(isPresented:attachmentAnchor:arrowEdge:content:)

Presents a popover when a given condition is true.

```
nonisolated func popover<Content>(isPresented: Binding<Bool>, attachmentAnchor: PopoverAttachmentAnchor = .rect(.bounds), arrowEdge: Edge? = nil, @ContentBuilder content: @escaping () -> Content) -> some TabContent<Self.TabValue> where Content : View
```

## Parameters

`isPresented`

A binding to a Boolean value that determines whether
to present the popover content that you return from the modifier’s
`content` closure.

`attachmentAnchor`

The positioning anchor that defines the
attachment point of the popover. The default is
[`bounds`](/documentation/SwiftUI/Anchor/Source/bounds).

`arrowEdge`

The edge of the `attachmentAnchor` that defines the
location of the popover’s arrow in macOS. The default is [`Edge.top`](/documentation/SwiftUI/Edge/top).

`content`

A closure returning the content of the popover.

## Discussion

Use this method to show a popover whose contents are a SwiftUI view
that you provide when a bound Boolean variable is `true`. In the
example below, a popover displays whenever the user toggles
the `isShowingPopover` state variable by pressing the
“Show Popover” button:

```
struct PopoverExample: View {
    @State private var isShowingPopover = false

    var body: some View {
        TabView {
            Tab("Popover Anchor", systemImage: "arrow.down") {
                Button("Show Popover") {
                    self.isShowingPopover = true
                }
            }
            .popover(isPresented: $isShowingPopover) {
                Text("Popover Content")
                    .padding()
            }
        }
    }
}
```

---

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)