androidx.compose.foundation
combinedClickable
Function · from org.jetbrains.compose.foundation:foundation:1.12.2
No hand-written docs yet.
Configure component to receive clicks, double clicks and long clicks via input or accessibility "click" event.
Form 1
fun Modifier.combinedClickable(
enabled: Boolean = true,
onClickLabel: String? = null,
role: Role? = null,
onLongClickLabel: String? = null,
onLongClick: (() -> Unit)? = null,
onDoubleClick: (() -> Unit)? = null,
hapticFeedbackEnabled: Boolean = true,
interactionSource: MutableInteractionSource? = null,
onClick: () -> Unit,
): Modifier
enabled: BooleanOptional
enabled: BooleanOptionalDefault: true
Controls the enabled state. When false, onClick, onLongClick or onDoubleClick won't be invoked
onClickLabel: String?Optional
onClickLabel: String?OptionalDefault: null
semantic / accessibility label for the onClick action
role: Role?Optional
role: Role?OptionalDefault: null
the type of user interface element. Accessibility services might use this to describe the element or do customizations
onLongClickLabel: String?Optional
onLongClickLabel: String?OptionalDefault: null
semantic / accessibility label for the onLongClick action
onLongClick: (() -> Unit)?Optional
onLongClick: (() -> Unit)?OptionalDefault: null
will be called when user long presses on the element
onDoubleClick: (() -> Unit)?Optional
onDoubleClick: (() -> Unit)?OptionalDefault: null
will be called when user double clicks on the element
hapticFeedbackEnabled: BooleanOptionalSince 1.8
hapticFeedbackEnabled: BooleanOptionalSince 1.8Default: true
whether to use the default HapticFeedback behavior
interactionSource: MutableInteractionSource?Optional
interactionSource: MutableInteractionSource?OptionalDefault: null
MutableInteractionSource that will be used to dispatch PressInteraction.Press when this clickable is pressed. If null, an internal MutableInteractionSource will be created if needed.
onClick: () -> UnitRequired
onClick: () -> UnitRequiredwill be called when user clicks on the element
With indication
fun Modifier.combinedClickable(
interactionSource: MutableInteractionSource?,
indication: Indication?,
enabled: Boolean = true,
onClickLabel: String? = null,
role: Role? = null,
onLongClickLabel: String? = null,
onLongClick: (() -> Unit)? = null,
onDoubleClick: (() -> Unit)? = null,
hapticFeedbackEnabled: Boolean = true,
onClick: () -> Unit,
): Modifier
indication: Indication?Required
indication: Indication?Requiredindication to be shown when modified element is pressed. By default, indication from LocalIndication will be used. Pass null to show no indication, or current value from LocalIndication to show theme default
Same as above: interactionSource, enabled, onClickLabel, role, onLongClickLabel, onLongClick, onDoubleClick, hapticFeedbackEnabled, onClick.
Library docs
Configure component to receive clicks, double clicks and long clicks via input or accessibility "click" event.
Add this modifier to the element to make it clickable within its bounds.
If you need only click handling, and no double or long clicks, consider using clickable
This overload will use the Indication from LocalIndication. Use the other overload to
explicitly provide an Indication instance. Note that this overload only supports
IndicationNodeFactory instances provided through LocalIndication - it is strongly recommended
to migrate to IndicationNodeFactory, but you can use the other overload if you still need to
support Indication instances that are not IndicationNodeFactory.
If interactionSource is null, an internal MutableInteractionSource will be lazily created
only when needed. This reduces the performance cost of combinedClickable during composition, as
creating the indication can be delayed until there is an incoming
androidx.compose.foundation.interaction.Interaction. If you are only passing a remembered
MutableInteractionSource and you are never using it outside of combinedClickable, it is
recommended to instead provide null to enable lazy creation. If you need the Indication to be
created eagerly, provide a remembered MutableInteractionSource.
Note, if the modifier instance gets re-used between a key down and key up events, the ongoing input will be aborted.
Note Any removal operations on Android Views from clickable should wrap onClick in a
post { } block to guarantee the event dispatch completes before executing the removal. (You do
not need to do this when removing a composable because Compose guarantees it completes via the
snapshot state system.)