Compose Modifier

focusable

Configure component to be focusable via focus system or accessibility "focus" event.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free

focusable

Common
fun Modifier.focusable(
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource? = null,
) =
    this.then(
        if (enabled) {
            FocusableElement(interactionSource)
        } else {
            Modifier
        }
    )

Configure component to be focusable via focus system or accessibility "focus" event.

Add this modifier to the element to make it focusable within its bounds.

Parameters

enabled Controls the enabled state. When false, element won't participate in the focus
interactionSource MutableInteractionSource that will be used to emit FocusInteraction.Focus when this element is being focused.