<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CustomHoverEffect/ornament(attachmentAnchor:contentAlignment:ornament:effect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI17CustomHoverEffectPAAE8ornament16attachmentAnchor16contentAlignmentAD6effectAA08Ornamentd7ContentE0Vyqd__qd_0_GAA0l10AttachmentH0V_AA11Alignment3DVqd__yXEqd_0_AA05EmptydeM0V_SbAA13GeometryProxyVtctAJRszAA4ViewRd__AA0deM0Rd_0_r0_lFZ"
  },
  "title" : "ornament(attachmentAnchor:contentAlignment:ornament:effect:)"
}
-->

# ornament(attachmentAnchor:contentAlignment:ornament:effect:)

Presents an ornament on hover.

```
nonisolated static func ornament<Content, EffectContent>(attachmentAnchor: OrnamentAttachmentAnchor, contentAlignment: Alignment3D = .center, @ContentBuilder ornament: () -> Content, effect: @escaping (EmptyHoverEffectContent, Bool, GeometryProxy) -> EffectContent) -> OrnamentHoverContentEffect<Content, EffectContent> where Self == OrnamentHoverContentEffect<Content, EffectContent>, Content : View, EffectContent : HoverEffectContent
```

## Parameters

`attachmentAnchor`

The positioning anchor that defines the
attachment point of the ornament.

`contentAlignment`

The alignment of the ornament with its attachment anchor.

`ornament`

The content of the ornament.

`effect`

The effect used to present the ornament.

## Discussion

Use this method to present an ornament at the specified position when the
view is hovered. The ornament will be presented using the provided `effect`.

---

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)