🌈 Create new beautiful Compose Gradients with our new wesite ->
Interface

FocusState

The focus state of a FocusTargetNode.

Source set: Common
public interface FocusState

The focus state of a FocusTargetNode. Use onFocusChanged or onFocusEvent modifiers to access FocusState.

Properties

isFocused

Source set: Common
public val isFocused: Boolean

Whether the component is focused or not.

Return

true if the component is focused, false otherwise.

hasFocus

Source set: Common
public val hasFocus: Boolean

Whether the focus modifier associated with this FocusState has a child that is focused, or is itself focused (isFocused).

Return

true if the component or any of its children are focused, false otherwise.

isCaptured

Source set: Common
public val isCaptured: Boolean

Whether focus is captured or not. A focusable component is in a captured state when it wants to hold onto focus. (Eg. when a text field has an invalid phone number). When we are in a captured state, clicking on other focusable items does not clear focus from the currently focused item.

You can capture focus by calling focusRequester.captureFocus() and free focus by calling focusRequester.freeFocus().

Return

true if focus is captured, false otherwise.

Content updated: