You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The size options on the Card component often produce unequal horizontal/padding padding values. For example the largesize has 24px vertical padding and 32px horizontal padding.
It can sometimes be desirable to create cards with equal padding, or specify per-side padding values on subcomponents like Card.Header. Let's explore how to offer this functionality in a sustainable way (based on presets/tokens) while considering backwards compatibility.
One idea I had for this is to introduce some new properties: paddingTop, paddingRight, paddingBottom, paddingLeft.
Behavior
The existing size prop acts as a shorthand defining top, right, bottom, and left padding values.
When any per-side padding property is set, it overrides the corresponding side derived from size.
If size is omitted, each padding property applies independently.
The padding* props accept values from the spacing scale to maintain design consistency.
Backwards compatibility
All existing uses of size remain fully supported.
The new properties are additive and non-breaking.
This approach loosely mirrors CSS’s padding shorthand and side-specific properties, offering developers finer control without fragmenting existing patterns or requiring new size presets.
@gigitux with this approach am I correct in thinking that consumers couldn't specify that a card is medium-sized, but override the padding of just one side? Maybe it's okay, I'm not sure to be honest.
It would be neat if accepted values for the padding* values could be tokenised. So consumers could say paddingTop: small, where small references a value from the spacing scale.
Activity
jameskoster commentedon Oct 9, 2025
One idea I had for this is to introduce some new properties:
paddingTop,paddingRight,paddingBottom,paddingLeft.Behavior
sizeprop acts as a shorthand defining top, right, bottom, and left padding values.size.sizeis omitted, each padding property applies independently.padding*props accept values from the spacing scale to maintain design consistency.Backwards compatibility
sizeremain fully supported.This approach loosely mirrors CSS’s padding shorthand and side-specific properties, offering developers finer control without fragmenting existing patterns or requiring new size presets.
gigitux commentedon Oct 17, 2025
@jameskoster Instead to add a new prop, what do you think if size looks like this:
In this way,
Cardcan be consumed in this way:gigitux commentedon Oct 17, 2025
Even in this case, the properties are additive, but the logic would be simpler.
cc @mirka
jameskoster commentedon Oct 17, 2025
@gigitux with this approach am I correct in thinking that consumers couldn't specify that a card is medium-sized, but override the padding of just one side? Maybe it's okay, I'm not sure to be honest.
It would be neat if accepted values for the
padding*values could be tokenised. So consumers could saypaddingTop: small, wheresmallreferences a value from the spacing scale.mirka commentedon Oct 20, 2025
Sounds good to me.
Something like that, maybe. We might not have to support
numberif we have per-side tokens.