Decrease padding inside Compose Button

Viewed 934

How can I reduce the padding inside the button? I want the text to be closer to the edge of the button

Button(
        onClick = {},
        modifier = Modifier.padding(0.dp),
        shape = RoundedCornerShape(30.dp),
        border = BorderStroke(1.dp, Color(0xFFC4C4C4)),
        colors = ButtonDefaults.buttonColors(
            contentColor = MaterialTheme.colors.onBackground,
            backgroundColor = MaterialTheme.colors.onBackground
        )
    ) {
        Text(
            text = "lorem ipsu",
            fontSize = 13.sp,
            textAlign = TextAlign.Center,
            modifier = Modifier.padding(start = 1.dp, end = 1.dp)
        )

}

1 Answers

You can use contentPadding

Button(
    onClick = {},
    contentPadding = PaddingValues(
        start = 4.dp,
        top = 4.dp,
        end = 4.dp,
        bottom = 4.dp,
    )
) {
    // TODO
}
Related