Google is committed to advancing racial equity for Black communities. See how.

FocusManager

class FocusManager
kotlin.Any
   ↳ androidx.compose.ui.focus.FocusManager

The focus manager is used by different Owner implementations to control focus.

Summary

Public constructors

The focus manager is used by different Owner implementations to control focus.

Public methods
Unit

Call this function to set the focus to the root focus modifier.

Unit

The Owner calls this function when it loses focus.

Unit

The Owner calls this function when it gains focus.

Properties
Modifier

Public constructors

<init>

FocusManager()

The focus manager is used by different Owner implementations to control focus.

Public methods

clearFocus

fun clearFocus(): Unit

Call this function to set the focus to the root focus modifier.

This could be used to clear focus when a user clicks on empty space outside a focusable component.

releaseFocus

fun releaseFocus(): Unit

The Owner calls this function when it loses focus. This informs the focus manager that the Owner lost focus, and that it should clear focus from all the focus modifiers in the component hierarchy.

takeFocus

fun takeFocus(): Unit

The Owner calls this function when it gains focus. This informs the focus manager that the Owner gained focus, and that it should propagate this focus to one of the focus modifiers in the component hierarchy.

Properties

modifier

val modifier: Modifier