https://kotlinlang.org logo
Title
c

Cristian Rosa

01/13/2022, 3:21 AM
Does anybody know if there is any issue with
androidx.compose.material3
v1.0.0-alpha02
and setting (according material 3 specification) right color on TextButton
TextButton(
    onClick = onConfirm,
    enabled = onConfirmEnable,
    colors = ButtonDefaults.textButtonColors(
        contentColor = MaterialTheme.colorScheme.primary,
        disabledContentColor = Color.Red,
        containerColor = Color.Transparent,
        disabledContainerColor = Color.Transparent,
    )
Doing by this che color always have primary color even when it’s disable…..I know those “transparent” look ugly, they were just for test it quicker! 😄
My bad..... The inner color set for the text was rightly taking over the setting made by the outer! ,😅
m

Maryam Alhuthayfi [MOD]

01/13/2022, 9:02 PM
Hey, does the below code fix your problem?
TextButton(
        onClick = onConfirm,
        enabled = onConfirmEnable,
        colors = ButtonDefaults.textButtonColors(
            contentColor = MaterialTheme.colorScheme.primary,
            disabledContentColor = Color.Red,
            backgroundColor = Color.Transparent,
        ),
    ){
        // Add content here
    }