Material `Button` applies some inset even though ...
# compose
c
Material
Button
applies some inset even though
elevation
+
contentPadding
is set to zero.
Copy code
Button(
        modifier = modifier
            .size(46.dp)
            .padding(0.dp).background(Color.Green),
        elevation = ButtonDefaults.buttonElevation(
            // all zero
        ),
        shape = RoundedCornerShape(13.dp),
        contentPadding = PaddingValues(0.dp)
    ) {
        Icon(
            painter = iconPainter,
            contentDescription = contentDescription,
            modifier = Modifier.size(20.dp)
        )
    }
gives me
f
Not sure, just a guess but I think thats enforced LocalMinimumTouchTarget size (48 dp)
c
oh, thanks. wasn’t considering that 🤔
f
You can disable that by overriding
LocalMinimumTouchTargetEnforcement
composition local on your button
c
thank you - that was actually the cause. 👍
👌 1