KwikButton

fun KwikButton(modifier: Modifier = Modifier, text: Any, isLoading: Boolean = false, loadingText: String = "", outlined: Boolean = false, leadingIcon: Any? = null, trailingIcon: Any? = null, containerColor: Color = MaterialTheme.colorScheme.primary, tintIcon: Boolean = true, enabled: Boolean = true, fontStyle: TextStyle = MaterialTheme.typography.titleSmall, kwikButtonLoadingStyle: KwikButtonLoadingStyle = KwikButtonLoadingStyle.CIRCULAR, shape: Shape = MaterialTheme.shapes.medium, border: BorderStroke? = null, contentPadding: PaddingValues = PaddingValues(2.dp), onClick: () -> Unit = {})

A versatile button that can be customized to suit different use cases.

Parameters

modifier

Modifier to be applied to the button.

text

The text to be displayed on the button. Can be a String, Int or AnnotatedString.

isLoading

Whether the button is in a loading state.

loadingText

The text to be displayed when the button is in a loading state.

outlined

Whether the button should be outlined.

leadingIcon

The icon to be displayed before the text. Can be an Int or ImageVector.

trailingIcon

The icon to be displayed after the text. Can be an Int or ImageVector.

height

The height of the button.

containerColor

The color of the button.

tintIcon

Whether the icon should be tinted with the button color.

enabled

Whether the button is enabled.

fontStyle

The style of the text. Refer to TextStyle and MaterialTheme.typography.

kwikButtonLoadingStyle

The style of the loading indicator. Can be KwikButtonLoadingStyle.CIRCULAR or KwikButtonLoadingStyle.LINEAR.

onClick

The action to be performed when the button is clicked.

Example usage:

KwikButton(
text = "Click me",
onClick = { /* Do something */}
)
KwikButton(
text = stringResource(id = R.string.click_me),
onClick = { /* Do something */ },
outlined = true,
leadingIcon = Icons.Default.Add,
loadingText = "Loading...",
isLoading = true,
)