Skip to content

ButtonCore

@Composable



fun ButtonCore(
    onClick: (AUINode) -> Unit, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    content: @Composable



 (isHovered: Boolean, isPressed: Boolean) -> Unit
)

A stateless clickable container composable.

ButtonCore manages hover and pressed state internally and exposes them to content via the lambda parameters. It handles cursor changes and the full pointer-event lifecycle, but applies no visual styling of its own — that is left entirely to content.

Use ButtonCore when you need custom button visuals. For a standard themed button, use the higher-level Button composable in your theme-aware composables package.

Example

ButtonCore(onClick = { println("Clicked!") }) { isHovered, isPressed ->
    Box(
        modifier = Modifier.background(if (isHovered) KColor.LIGHT_GRAY else KColor.GRAY)
            .size(80, 20)
    ) {
        Text(Component.literal("Click me"))
    }
}

Parameters

  • onClick: Invoked with the receiving AUINode when the button is pressed.

  • modifier: Additional modifiers applied to the outer Box.

  • enabled: When false, pointer events are ignored and no cursor change occurs.

  • content: The button's visual content, receiving isHovered and isPressed booleans.