Stack: allow gaps, margins, and paddings to use named themable sizing values
Stack has a gap prop right now, which controls the space in between each of its children. This is super useful for creating layouts with consistent spacing between items. No more inconsistent solutions for this super common problem.
But if we have gap={randomPixelValue} everywhere, it becomes difficult to change that in a theme. If we create an abstraction on this similar to text font sizes, we can control these abstractions in a theme and provide a central place for adjusting the knobs.
Code example:
loadTheme({
sizing: {
tiny: 1
xxxSmall: 2,
xxSmall: 2,
xSmall: 4,
small: 6,
regular: 8,
large: 16,
xLarge: 20,
xxLarge: 40,
xxxLarge: 80,
mega: 160
}
});
@mikewheaton @betrue-final-final @Jahnp What we want to do here is to abstract sizing values so that we avoid hardcoding sizes in a million different places. This allows our design language to change later on to a larger grid. I think we can also consider conditionalizing themes based on the viewport dimensions (e.g. in a smaller screensize, we adjust these numbers and things render a bit tighter, or on full width marketing pages, we adjust this to render things a bit looser.)
Here's an example of how we might use this:
<Stack gap='large'>
<Section ... />
<Section ... />
</Stack>
Let us know what your thoughts are here in terms of stops, naming, etc. Do these stops make sense? Are there too many? Are there scenarios where we really need 3px instead of 4?
Please add a none:0 to the gap enum
Closed by #6359