JengaButton

fun JengaButton(text: String, onClick: () -> Unit, modifier: Modifier = Modifier, variant: JengaButtonVariant = JengaButtonVariant.Primary, size: JengaButtonSize = JengaButtonSize.Medium, enabled: Boolean = true, loading: Boolean = false, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, colors: JengaButtonColors = JengaButtonDefaults.colors(variant), loadingText: String? = null, contentPadding: PaddingValues = JengaTheme.components.button?.size(size)?.contentPadding ?: JengaButtonDefaults.contentPadding(size), textStyle: TextStyle = JengaButtonDefaults.textStyle(size))(source)

A Jenga button: the primary way to trigger an action.

This is the convenience overload that renders a text label with the size-appropriate style. For custom content (e.g. icon + multi-style text), use the slot overload below.

Parameters

text

the button label.

onClick

called when the button is tapped (ignored while disabled/loading).

modifier

the Modifier for this button.

variant

the visual style; see JengaButtonVariant.

size

the button size; see JengaButtonSize.

enabled

whether the button is interactive.

loading

when true, shows a spinner and blocks clicks.

leadingIcon

optional icon before the label.

trailingIcon

optional icon after the label.

colors

the color set; defaults to JengaButtonDefaults.colors for variant.

loadingText

optional label shown beside the spinner while loading.

contentPadding

inner padding; defaults to the theme's JengaButtonSizeStyle.contentPadding for size, else JengaButtonDefaults.contentPadding.

textStyle

the label style; defaults to JengaButtonDefaults.textStyle for size.

Samples

JengaButton(
    text = "Check in",
    onClick = { },
    variant = JengaButtonVariant.Primary,
)

fun JengaButton(onClick: () -> Unit, modifier: Modifier = Modifier, variant: JengaButtonVariant = JengaButtonVariant.Primary, size: JengaButtonSize = JengaButtonSize.Medium, enabled: Boolean = true, loading: Boolean = false, leadingIcon: @Composable () -> Unit? = null, trailingIcon: @Composable () -> Unit? = null, shape: Shape = JengaTheme.components.button?.size(size)?.shape ?: JengaButtonDefaults.shape, colors: JengaButtonColors = JengaButtonDefaults.colors(variant), contentPadding: PaddingValues = JengaTheme.components.button?.size(size)?.contentPadding ?: JengaButtonDefaults.contentPadding(size), content: @Composable RowScope.() -> Unit)(source)

A Jenga button with a custom content slot.

Parameters

onClick

called when the button is tapped (ignored while disabled/loading).

modifier

the Modifier for this button.

variant

the visual style; see JengaButtonVariant.

size

the button size; see JengaButtonSize.

enabled

whether the button is interactive.

loading

when true, shows a spinner and blocks clicks.

leadingIcon

optional icon before the content.

trailingIcon

optional icon after the content.

shape

the button shape; defaults to the theme's JengaButtonSizeStyle.shape for size, else JengaButtonDefaults.shape.

colors

the color set; defaults to JengaButtonDefaults.colors for variant.

contentPadding

inner padding; defaults to the theme's JengaButtonSizeStyle.contentPadding for size, else JengaButtonDefaults.contentPadding.

content

the button content; rendered with the resolved content color.