KButton

fun KButton(onClick: () -> Unit, modifier: Modifier = Modifier, variant: KButtonVariant = KButtonVariant.Default, size: KButtonSize = KButtonSize.Default, enabled: Boolean = true, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable RowScope.() -> Unit)(source)

Shadcn/ui-style Button — mirrors button.tsx.

A versatile button component that supports various visual variants, sizes, and states (including a loading state). It adheres to the Kindling design system and ensures proper accessibility and RTL support.

Respects LocalLayoutDirection automatically — icon/content order is never reversed programmatically; rely on Compose's RTL mirroring.

Example usage:

// Primary action
KButton(onClick = { /* Save */}) {
Text("Save")
}

// Outline variant with small size
KButton(
onClick = { /* Cancel */},
variant = KButtonVariant.Outline,
size = KButtonSize.Sm
) {
Text("Cancel")
}

// Loading state
KButton(onClick = {}, isLoading = true) {
Text("Logging in...")
}

Parameters

onClick

Callback invoked when the button is clicked.

modifier

The modifier to be applied to the button.

variant

The visual style variant of the button. Defaults to KButtonVariant.Default.

size

The size variant of the button. Defaults to KButtonSize.Default.

enabled

Whether the button is enabled for interaction.

isLoading

Whether to show a loading indicator instead of the content.

interactionSource

The MutableInteractionSource to represent the stream of interactions.

content

The composable content to display inside the button (typically text or an icon).


fun KButton(text: String, onClick: () -> Unit, modifier: Modifier = Modifier, variant: KButtonVariant = KButtonVariant.Default, size: KButtonSize = KButtonSize.Default, enabled: Boolean = true, isLoading: Boolean = false)(source)

A convenience overload of KButton that accepts a plain string as a label.

Example usage:

KButton(text = "Submit", onClick = { /* Submit form */})

Parameters

text

The label text to display inside the button.

onClick

Callback invoked when the button is clicked.

modifier

The modifier to be applied to the button.

variant

The visual style variant of the button.

size

The size variant of the button.

enabled

Whether the button is enabled for interaction.

isLoading

Whether to show a loading indicator instead of the content.