KLabel
fun KLabel(text: String, modifier: Modifier = Modifier, disabled: Boolean = false, style: TextStyle = MaterialTheme.typography.labelLarge.copy(
fontSize = 14.sp,
fontWeight = FontWeight.Medium,
lineHeight = 20.sp,
letterSpacing = 0.1.sp
), color: Color = if (disabled)
MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f)
else
MaterialTheme.colorScheme.onBackground)(source)
Shadcn/ui-style Label — mirrors label.tsx.
A specialized text component used for labeling form fields or other UI elements. It automatically applies standard styling and handles the disabled state by adjusting its color to match the theme's disabled surface color.
Respects LocalLayoutDirection for RTL text alignment.
Example usage:
Column(verticalArrangement = Arrangement.spacedBy(4.dp)) {
KLabel("Email address")
KInput(value = email, onValueChange = { email = it })
}Content copied to clipboard
Parameters
text
The label text to display.
modifier
The modifier to be applied to the text.
disabled
Whether the label should appear in a disabled state.
style
The text style to apply. Defaults to MaterialTheme.typography.labelLarge with Kindling adjustments.
color
The text color. Defaults to a color based on the disabled state and current theme.