{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

InteractiveComponentSizeKt

public final class InteractiveComponentSizeKt


Summary

Public methods

static final @NonNull ProvidableCompositionLocal<@NonNull Boolean>

CompositionLocal that configures whether Material components that have a visual size that is lower than the minimum touch target size for accessibility (such as Button) will include extra space outside the component to ensure that they are accessible.

static final @NonNull ProvidableCompositionLocal<@NonNull Boolean>

CompositionLocal that configures whether Material components that have a visual size that is lower than the minimum touch target size for accessibility (such as Button) will include extra space outside the component to ensure that they are accessible.

static final @NonNull Modifier

Reserves at least 48.dp in size to disambiguate touch interactions if the element would measure smaller.

Public methods

getLocalMinimumInteractiveComponentEnforcement

@ExperimentalMaterial3Api
public static final @NonNull ProvidableCompositionLocal<@NonNull BooleangetLocalMinimumInteractiveComponentEnforcement()

CompositionLocal that configures whether Material components that have a visual size that is lower than the minimum touch target size for accessibility (such as Button) will include extra space outside the component to ensure that they are accessible. If set to false there will be no extra space, and so it is possible that if the component is placed near the edge of a layout / near to another component without any padding, there will not be enough space for an accessible touch target.

getLocalMinimumTouchTargetEnforcement

@ExperimentalMaterial3Api
public static final @NonNull ProvidableCompositionLocal<@NonNull BooleangetLocalMinimumTouchTargetEnforcement()

CompositionLocal that configures whether Material components that have a visual size that is lower than the minimum touch target size for accessibility (such as Button) will include extra space outside the component to ensure that they are accessible. If set to false there will be no extra space, and so it is possible that if the component is placed near the edge of a layout / near to another component without any padding, there will not be enough space for an accessible touch target.

minimumInteractiveComponentSize

public static final @NonNull Modifier minimumInteractiveComponentSize(@NonNull Modifier receiver)

Reserves at least 48.dp in size to disambiguate touch interactions if the element would measure smaller.

https://m3.material.io/foundations/accessible-design/accessibility-basics#28032e45-c598-450c-b355-f9fe737b1cd8

This uses the Material recommended minimum size of 48.dp x 48.dp, which may not the same as the system enforced minimum size. The minimum clickable / touch target size (48.dp by default) is controlled by the system via ViewConfiguration` and automatically expanded at the touch input layer.

This modifier is not needed for touch target expansion to happen. It only affects layout, to make sure there is adequate space for touch target expansion.