KPButton
A customizable button component that wraps androidx.compose.material.Button. It adapts colors, paddings, and other properties based on the provided style and size parameters.
This button provides a standardized appearance and behavior, integrating seamlessly with the application's theme and design requirements.
Parameters
Lambda to be executed when the button is clicked.
Configuration for the button's appearance, defined by ButtonStyle. It includes colors, borders, and other stylistic options.
Configuration for the button's dimensions and padding, defined by ButtonSize. It specifies the minimum height, content padding, and typography settings.
Boolean flag that determines whether the button is clickable. When false
, the button is styled as disabled according to the given style. Default is true
.
MutableInteractionSource to track interaction events such as clicks and presses. Default is a new instance of MutableInteractionSource.
Elevation for the button, providing depth and shadow effects. Default is ButtonElevation
from KPButtonDefaults.elevation.
Shape of the button's outline. Default is MaterialTheme.shapes.small
.
BorderStroke for the button's border, determined by style.getBorder. The width defaults to 1.dp
, and the appearance depends on the enabled state.
ButtonColors for the button's background, content, and other color properties. Default is style.buttonColors.
PaddingValues for the button's internal padding. Default is provided by size.contentPadding.
A composable lambda for defining the content inside the button. Typically includes text or icons.
Example usage:
KPButton(
onClick = { /* Handle click */},
style = KPButtonStyle.Primary,
size = KPButtonSize.Medium,
) {
Text("Click Me")
}