Function

clickable

Configure component to receive clicks via input or accessibility "click" event.

clickable

Source set: JvmAndAndroid
public fun RemoteModifier.clickable(
    onClick: RemoteAction,
    enabled: Boolean = true,
    role: RemoteRole? = null,
): RemoteModifier

Configure component to receive clicks via input or accessibility "click" event.

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

If you need to support double click or long click alongside the single click, consider using combinedClickable.

Example of toggling remote state when an element is clicked:

Parameters

onClick will be called when user clicks on the element
enabled Controls the enabled state. When false, onClick, and this modifier will appear disabled for accessibility services
role the type of user interface element. Accessibility services might use this to describe the element or do customizations. By default, no role is set (null).

Return

a RemoteModifier that makes the component clickable

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: