focusEffectDisabled
Adds a condition that controls whether this view can display focus effects, such as a default focus ring or hover effect.
Declaration
compose().focusEffectDisabled(disabled?: boolean)nonisolated func focusEffectDisabled(
_ disabled: Bool = true
) -> some ViewParameters
disabledbooleanA Boolean value that determines whether this view can display focus effects.
Return value
A view that controls whether focus effects can be displayed in this view.
Discussion
The higher views in a view hierarchy can override the value you set on
this view. In the following example, the button does not display a focus
effect because the outer focusEffectDisabled(_:) modifier overrides
the inner one:
HStack {
Button("Press") {}
.focusEffectDisabled(false)
}
.focusEffectDisabled(true)See also
More in Focus.
- defaultFocusDefines a region of the window in which default focus is evaluated by assigning a value to a given focus state binding.
- focusableSpecifies if the view is focusable.
- focusedModifies this view by binding its focus state to the given Boolean state value.
- searchFocusedModifies this view by binding the focus state of the search field associated with the nearest searchable modifier to the given Boolean value.