---
title: "defaultHoverEffect(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/defaulthovereffect(_:)"
---

# defaultHoverEffect(_:)

Sets the default hover effect to use for views within this view.

## Declaration

```swift
nonisolated func defaultHoverEffect(_ effect: HoverEffect?) -> some View

```

## Parameters

- `effect`: The default hover effect to use for views within this view.

## Return Value

Return Value A view that uses this effect as the default hover effect.

## Discussion

Discussion Use this modifier to set a specific hover effect for all views with the hoverEffect(_:) modifier applied within a view. The default effect is typically used when no HoverEffect was provided or if automatic is specified. For example, this view uses highlight for both the red and green Color views: HStack {     Color.red.hoverEffect()     Color.green.hoverEffect() } .defaultHoverEffect(.highlight) This also works for customizing the default hover effect in views like Buttons when using a SwiftUI-defined style like ButtonStyle/bordered, which can provide a hover effect by default. For example, this view replaces the hover effect for a Button with highlight: Button("Next") {}     // perform action } .buttonStyle(.bordered) .defaultHoverEffect(.highlight) Use a nil effect to indicate that the default hover effect should not be modified.

## See Also

### Responding to hover events

- [onHover(perform:)](swiftui/view/onhover(perform:).md)
- [onContinuousHover(coordinateSpace:perform:)](swiftui/view/oncontinuoushover(coordinatespace:perform:).md)
- [hoverEffect(_:isEnabled:)](swiftui/view/hovereffect(_:isenabled:).md)
- [hoverEffectDisabled(_:)](swiftui/view/hovereffectdisabled(_:).md)
- [isHoverEffectEnabled](swiftui/environmentvalues/ishovereffectenabled.md)
- [HoverPhase](swiftui/hoverphase.md)
- [HoverEffectPhaseOverride](swiftui/hovereffectphaseoverride.md)
- [OrnamentHoverContentEffect](swiftui/ornamenthovercontenteffect.md)
- [OrnamentHoverEffect](swiftui/ornamenthovereffect.md)
