fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Stack: allow gaps, margins, and paddings to use named themable sizing values

Open dzearing opened this issue 8 years ago • 2 comments

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?

dzearing avatar Aug 08 '18 00:08 dzearing

Please add a none:0 to the gap enum

iamscottm avatar Aug 14 '18 20:08 iamscottm

Closed by #6359

kkjeer avatar Sep 21 '18 20:09 kkjeer