Button

@Composable
fun Button(modifier: Modifier = Modifier, state: ButtonState, icon: @Composable () -> Unit? = null, paddingValues: PaddingValues = getPaddingValues(icon != null), onClick: () -> Unit)

DHIS2 button with generic icon slot. wraps DHIS2 SimpleButton which in turn wraps material 3 Button.

Parameters

modifier

: optional Modifier.

state

: Controls the state of the button.

icon

: The button icon content.

paddingValues

: optional PaddingValues to be overridden.

onClick

:Will be called when the user clicks the button.


@Composable
fun Button(enabled: Boolean = true, style: ButtonStyle = ButtonStyle.OUTLINED, colorStyle: ColorStyle = ColorStyle.DEFAULT, text: String, icon: @Composable () -> Unit? = null, modifier: Modifier = Modifier, paddingValues: PaddingValues = getPaddingValues(icon != null), onClick: () -> Unit)

Deprecated

Use constructor with ButtonState instead

Replace with

Button(modifier = modifier, state = ButtonState(text = text, enabled = enabled, style = style, colorStyle = colorStyle), icon = icon, paddingValues = paddingValues, onClick = onClick)

DHIS2 button with generic icon slot. wraps DHIS2 SimpleButton which in turn wraps material 3 Button.

Parameters

enabled

: Controls the enabled state of the button. When false, this button will not be clickable and will appear disabled to accessibility services.

style

: Controls style of the button. Will be OUTLINED by default, but can be FILLED, TEXT, TONAL, ELEVATED or KEYBOARDKEY.

colorStyle

: the button color style to be used, can be ColorStyle.DEFAULT or ColorStyle.ERROR.

text

: The text to display within.

icon

: The button icon content.

paddingValues

: optional PaddingValues to be overridden.

modifier

: optional Modifier.

onClick

:Will be called when the user clicks the button.