FocusProperties
interface FocusProperties
Properties that are applied to focusTarget that is the first child of the
FocusPropertiesModifierNode that sets these properties.
Properties
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.
var next: FocusRequester
A custom item to be used when the user requests the focus to move to the "next" item.
var previous: FocusRequester
A custom item to be used when the user requests the focus to move to the "previous" item.
var up: FocusRequester
A custom item to be used when the user moves focus "up".
var down: FocusRequester
A custom item to be used when the user moves focus "down".
var left: FocusRequester
A custom item to be used when the user requests a focus moves to the "left" item.
var right: FocusRequester
A custom item to be used when the user requests a focus moves to the "right" item.
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.
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.
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.
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.
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.
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.
var focusRect: Rect
Sets the focus area for the associated focus target to which these FocusProperties are
applied on.
If you simply ignore and do not set this value, UnsetFocusRect will be used. Or
alternatively you can set this value to UnsetFocusRect to prevent other FocusProperties
nodes in the chain from customizing the focus area.
