---
title: "hoverEffect(in:isEnabled:body:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/hovereffect(in:isenabled:body:)"
---

# hoverEffect(in:isEnabled:body:)

Applies a hover effect to this view described by the given closure.

## Declaration

```swift
nonisolated func hoverEffect(in group: HoverEffectGroup? = nil, isEnabled: Bool = true, body: @escaping (EmptyHoverEffectContent, Bool, GeometryProxy) -> some HoverEffectContent) -> some View

```

## Parameters

- `group`: An optional doc://com.apple.SwiftUI/documentation/SwiftUI/HoverEffectGroup to add this effect to.
- `isEnabled`: Whether the effect is enabled or not. If false, the effect’s inactive state will be applied, and it will not apply the active state when hovered.
- `body`: The closure that constructs a HoverEffectContent for each of the effect’s phases.

## Return Value

Return Value A new effect that changes a view’s appearance when hovered.

## Discussion

Discussion You use this modifier to describe how a view should change when hovered. The given block is provided an empty effect that you use to compose effects, as well as a boolean describing which phase is being requested. A GeometryProxy is also provided, allowing effects to change based on the view’s geometry. In the following example, the Text will have a scale of 1.0 when inactive, and then scale to 1.1 when hovered: Text("Hello, World!")     .hoverEffect { effect, isActive, proxy in         effect.scaleEffect(!isActive ? 1.0 : 1.1)     } Use the animation(_:body:) modifier to specify how visual changes should be animated.

## See Also

### Changing view appearance for hover events

- [hoverEffect(_:)](swiftui/view/hovereffect(_:).md)
- [HoverEffect](swiftui/hovereffect.md)
- [hoverEffect(_:in:isEnabled:)](swiftui/view/hovereffect(_:in:isenabled:).md)
- [CustomHoverEffect](swiftui/customhovereffect.md)
- [ContentHoverEffect](swiftui/contenthovereffect.md)
- [HoverEffectGroup](swiftui/hovereffectgroup.md)
- [hoverEffectGroup()](swiftui/view/hovereffectgroup().md)
- [hoverEffectGroup(_:)](swiftui/view/hovereffectgroup(_:).md)
- [hoverEffectGroup(id:in:behavior:)](swiftui/view/hovereffectgroup(id:in:behavior:).md)
- [GroupHoverEffect](swiftui/grouphovereffect.md)
- [HoverEffectContent](swiftui/hovereffectcontent.md)
- [EmptyHoverEffectContent](swiftui/emptyhovereffectcontent.md)
- [handPointerBehavior(_:)](swiftui/view/handpointerbehavior(_:).md)
- [HandPointerBehavior](swiftui/handpointerbehavior.md)
