---
title: "popover(item:attachmentAnchor:arrowEdge:content:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/tabcontent/popover(item:attachmentanchor:arrowedge:content:)"
---

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

Presents a popover using the given item as a data source for the popover’s content.

## Declaration

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

```

## Parameters

- `item`: A binding to an optional source of truth for the popover. When item is non-nil, the system passes the contents to the modifier’s closure. You use this content to populate the fields of a popover that you create that the system displays to the user. If item changes, the system dismisses the currently presented popover and replaces it with a new popover using the same process.
- `attachmentAnchor`: The positioning anchor that defines the attachment point of the popover. The default is doc://com.apple.SwiftUI/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 doc://com.apple.SwiftUI/documentation/SwiftUI/Edge/top.
- `content`: A closure returning the content of the popover.

## Discussion

Discussion Use this method when you need to present a popover with content from a custom data source. The example below uses data in the PopoverModel structure to populate the view in the content closure that the popover displays to the user: struct PopoverExample: View {     @State private var popover: PopoverModel?

var body: some View {         TabView {             Tab("Popover Anchor", systemImage: "arrow.down") {                 Button("Show Popover") {                     popover = PopoverModel(message: "Custom Message")                 }             }             .popover(item: $popover) { detail in                  Text("\(detail.message)")                     .padding()              }         }     } }

struct PopoverModel: Identifiable {     var id: String { message }     let message: String }

## See Also

### Configuring tab content

- [badge(_:)](swiftui/tabcontent/badge(_:).md)
- [contextMenu(menuItems:)](swiftui/tabcontent/contextmenu(menuitems:).md)
- [customizationBehavior(_:for:)](swiftui/tabcontent/customizationbehavior(_:for:).md)
- [customizationID(_:)](swiftui/tabcontent/customizationid(_:).md)
- [defaultSectionExpansion(_:)](swiftui/tabcontent/defaultsectionexpansion(_:).md)
- [TabSectionExpansion](swiftui/tabsectionexpansion.md)
- [defaultVisibility(_:for:)](swiftui/tabcontent/defaultvisibility(_:for:).md)
- [disabled(_:)](swiftui/tabcontent/disabled(_:).md)
- [draggable(_:)](swiftui/tabcontent/draggable(_:).md)
- [dropDestination(for:action:)](swiftui/tabcontent/dropdestination(for:action:).md)
- [help(_:)](swiftui/tabcontent/help(_:).md)
- [hidden(_:)](swiftui/tabcontent/hidden(_:).md)
- [popover(isPresented:attachmentAnchor:arrowEdge:content:)](swiftui/tabcontent/popover(ispresented:attachmentanchor:arrowedge:content:).md)
- [sectionActions(content:)](swiftui/tabcontent/sectionactions(content:).md)
- [springLoadingBehavior(_:)](swiftui/tabcontent/springloadingbehavior(_:).md)
