Why don't material3 Cards have a content padding parameter? Unless a full bleed image is being used (in which case the content padding could be 0), I don't think I've ever encountered a Card that didn't need its content padded. I can easily do that by adding a Column/Row/Box with a padding Modifier, but that seems unnecessary.
s
sindrenm
01/10/2025, 12:03 PM
Might be just me, but I fail to see the added benefit of a
contentPadding
parameter vs. just providing a
Modifier.padding()
to the child of the Card.
☝🏽 1
e
eygraber
01/10/2025, 12:58 PM
The Card provides a Column child for the content, and "exposes" that by having the connect receiver be a ColumnScope. However not being able to set the padding for that Column makes it functionally useless in many cases.
s
Stylianos Gakis
01/10/2025, 1:41 PM
Well, welcome to the club.
The first thing that I did in our version of
Card
in our design system is not wrap the content with a
Column
for no reason. Just put the items inside a
Box
with
propagateMinConstraints = true
and then you have full control over what you want to do in there.
When using m3, just ignore the ColumnScope, and always wrap your items in your own container in which you have control over things like padding etc.
So
Copy code
Card {
Column(config) {
YourContent()
}
}
s
sindrenm
01/10/2025, 1:49 PM
To be honest, I also think the decision of making the
I don't think the Card to Button comparison is correct because with Button I almost always want it to be a Row and don't care about setting the padding, but with a Card I almost always want it to be a Column, but also almost always want to set the padding.