Clickable¶
@Composable
fun Clickable(
onClick: (UINode) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
showHandCursor: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
onAuxClick: (UINode, Int) -> Unit? = null,
content: @Composable
(isHovered: Boolean, isPressed: Boolean, isFocused: Boolean) -> Unit
)
Low-level unstyled clickable container used by higher-level inputs like ButtonCore.
Tracks hover/press state via hoverable/pressable and fires onClick on press (not release), showing the system hand cursor on hover when showHandCursor is true. Also registers as a vanilla keyboard/controller focus-navigation stop (see focusable) and fires onClick on Enter/Space while focused - the same activation model Compose Foundation's own Modifier.clickable bakes in, rather than treating focus as a separate concern from click. Applies no visual styling itself - that is entirely up to content.
A press of any MouseButton fires onClick, as vanilla's own widgets do - unless onAuxClick is given, in which case onClick narrows to MouseButton.LEFT and every other button goes to onAuxClick. That is the only shape in which a right- or middle-click gesture is expressible here: pressable consumes the press, so a second modifier listening for the same event on the same node would never see it.
Parameters¶
-
onClick: Invoked with the receiving
UINodeon press, or on Enter/Space while vanilla-focused. Narrowed toMouseButton.LEFTwhenonAuxClickis given. -
modifier: Additional modifiers applied to the outer
Box. -
enabled: When
false, pointer and activation-key events are ignored, no cursor change occurs, and this drops out of the vanilla focus graph entirely. -
showHandCursor: Whether to switch to the hand cursor while hovered.
-
interactionSource: Backs
isHovered/isPressed/isFocused, collectible independently vianet.kernelpanicsoft.archie.gui.interaction.collectIsXAsStatetoo. -
onAuxClick: Invoked with the receiving
UINodeand theMouseButtonfor a press of any button butMouseButton.LEFT, ornullto route every button toonClick. -
content: The visual content; receives
isHovered/isPressed/isFocusedfor styling.