FocusProperties

Interface

Common
interface FocusProperties

Properties that are applied to focusTarget that is the first child of the FocusPropertiesModifierNode that sets these properties.

Properties

Common
var canFocus: Boolean

When set to false, indicates that the focusTarget that this is applied to can no longer take focus. If the focusTarget is currently focused, setting this property to false will end up clearing focus.

Common
var next: FocusRequester

A custom item to be used when the user requests the focus to move to the "next" item.

Common
var previous: FocusRequester

A custom item to be used when the user requests the focus to move to the "previous" item.

Common
var up: FocusRequester

A custom item to be used when the user moves focus "up".

Common
var down: FocusRequester

A custom item to be used when the user moves focus "down".

Common
var left: FocusRequester

A custom item to be used when the user requests a focus moves to the "left" item.

Common
var right: FocusRequester

A custom item to be used when the user requests a focus moves to the "right" item.

Common
var start: FocusRequester

A custom item to be used when the user requests a focus moves to the "left" in LTR mode and "right" in RTL mode.

Common
var end: FocusRequester

A custom item to be used when the user requests a focus moves to the "right" in LTR mode and "left" in RTL mode.

Common

Deprecated Use onEnter instead

@ExperimentalComposeUiApi

var enter: (FocusDirection) -> FocusRequester

A custom item to be used when the user requests focus to move focus in (FocusDirection.Enter). An automatic Enter" can be triggered when we move focus to a focus group that is not itself focusable. In this case, users can use the the focus direction that triggered the move in to determine the next item to be focused on.

When you set the enter property, provide a lambda that takes the FocusDirection that triggered the enter as an input, and provides a FocusRequester as an output. You can return a custom destination by providing a FocusRequester attached to that destination, a Cancel to cancel the focus enter or Default to use the default focus enter behavior.

Common
var onEnter: FocusEnterExitScope.() -> Unit

A custom item to be used when the user requests focus to move focus in (FocusDirection.Enter). An automatic Enter" can be triggered when we move focus to a focus group that is not itself focusable. In this case, users can use the the focus direction that triggered the move in to determine the next item to be focused on.

When you set the onEnter property, provide a lambda with the FocusEnterExitScope scope, having the FocusEnterExitScope.requestedFocusDirection that triggered the enter as an input. If redirection is required, use FocusRequester.requestFocus and if the focus change should be canceled, use FocusEnterExitScope.cancelFocusChange.

Common

Deprecated Use onExit instead

@ExperimentalComposeUiApi

var exit: (FocusDirection) -> FocusRequester

A custom item to be used when the user requests focus to move out (FocusDirection.Exit). An automatic Exit can be triggered when we move focus outside the edge of a parent. In this case, users can use the focus direction that triggered the move out to determine the next focus destination.

When you set the exit property, provide a lambda that takes the FocusDirection that triggered the exit as an input, and provides a FocusRequester as an output. You can return a custom destination by providing a FocusRequester attached to that destination, a Cancel to cancel the focus exit or Default to use the default focus exit behavior.

Common
var onExit: FocusEnterExitScope.() -> Unit

A custom item to be used when the user requests focus to move out (FocusDirection.Exit). An automatic Exit can be triggered when we move focus outside the edge of a parent. In this case, users can use the focus direction that triggered the move out to determine the next focus destination.

When you set the onExit property, provide a lambda with the FocusEnterExitScope scope, having the FocusEnterExitScope.requestedFocusDirection that triggered the exit as an input. If redirection is required, use FocusRequester.requestFocus and if the focus change should be canceled, use FocusEnterExitScope.cancelFocusChange.